MATLAB: Please proofread for a newbie :)

fsolvem-file

Hi, I am having so much trouble with matlab, this is what I have been trying:
function P=PR(V);
%Peng-Robinson EOS
%used to calculate vg and vl
R=8.314;
T=313.15;
b=5.63e-5;
a=1.1188;
P=1.3e6;
P=((R*T)./(V-b))-(a./(V*(V+b)+(b*(V-b))));
end
and then i do:
fsolve(@PR,1)
as I am trying to solve for V
it gives an answer that I know is not right, as I had the m-file working at uni today and now at home it just does not work. Any help or advice would be great, thanks

Best Answer

"fsolve(@PR, 1)" solves the equation "P=((R*T)./(V-b))-(a./(V*(V+b)+(b*(V-b))))" such that P==0 using the initial value V==1. Do you want to do this?
It worked in the University and now it does not calculate the correct answer? This would be very helpful: Then the error is inside the modifications you have inserted in between! Or the command FSOLVE of one of the computers is broken - but this is less likely.
Related Question