One potential issue - you have used the variable i twice. You should probably come up with a different counter variable for your second for loop.
You are also only plotting a single point at a time. This is likely why you can't see anything. Try changing your marker to something bigger.
You calculations are also returning imaginary numbers. I don't think there should be imaginary numbers in this calculation.
Here's a slightly reworked version.
R = 83.1446;
b = 29;
for temp = 200:10:900
T = temp + 273.15;
d = (-8374 + (19.437*T) - (8.148*0.001*T.^2))*10^6;
c = (290.78 - (0.30276*T) + (1.4774*0.0001*T.^2))*10^6;
e = (76600 - (133.9*T) + (0.1071*T.^2))*10^6;
for v =20:1:100
y = b/(4*v);
a = c + d./v + e./(v^2);
P = (R*T.*(1 + y + y.^2 - y.^3))./(v*(1-y)^3)- a./(sqrt(T)*v*(v+b));
Z = (1+y+y^2-y^3)./((1-y)^3) - a./(R*T.^1.5*(v+b));
lnf =(8*y-9*y^2+3*y^3)/((1-y)^3)- log(Z)- c/(R*T.^1.5*(v+b))-d/(R*T.^1.5*v*(v+b));
f=exp(lnf);
fi = abs(f.*P);
plot(P,fi,'o')
hold on
end
end
hold off
Best Answer