%Tc = input('PLease enter the critical temperature'); %Critical Temp. in Kelvins
Tc = 154.6;%Pc = input('Please enter the critical pressure'); %Critical Pressure in MPa
Pc = 50.46;%omega = input('Please enter the omega value of the Peng_robinson EOS');
omega = 0.021;k = 0.37464 + (1.54226 - 0.26992*omega)*omega;R = 0.08314; %gas constant in MPa*m3/mol*K
%v = input('Please enter a vector of pressure');
v = 1:10:100;%n = input('Please enter a vector of temperature');
n = [173 198 223 248 273 298 323 348 373 398 423];%n = 173;
b = 0.077796074*R*Tc/Pc;x=[];for P = v for T = n alpha = (1 + k*(1-sqrt((T/Tc))))^2; a = 0.457235529*(R*Tc)^2/Pc*alpha; B = b.*P/(R*T); A = a.*P/((R*T)^2); ZZ = ZZroot(A,B); V = ZZ*R*T./P end x(end+1)=V;end
What I am trying to do is, if possible, is for each element n, I add the values V computed for each corresponding different P(small v) to an array. For example,
[V(1) ; V(2) ; V(3); ...]. | v(1) v(2) v(3) ...| <- pressure small vn(1)| V(1) V(2) V(3) ...|n(2)| V(1) V(2) V(3) ...|n(3)| V(1) V(2) V(3) ...|...
Once I do that, I would like to plot each row as its own line in the same graph. x axis would be V and y axis v(small v).
Hope that makes sense. Thanks in advance.
Best Answer