%Am experiencing problems running this file, please find the the input data
.%%
%%
%propanes critical temperature and pressure and accentric factor
Tc=369.9;
Pc=42.0;
Omega=0.152;
%%
%universal gas constant
R=83.14;
% b and m for the PR EOS
b=0.7780*R*Tc/Pc;
m=0.37464+1.54226*Omega-0.26992*Omega^2;
j=1;
for i=40:10:90
%molar volume
v=0.001:1:2500;
%temperature
T(i)=273.15+i;
%reduced temperature
Tre=T(i)/Tc;
%a for the PR EOS
a = 0.45724*(R*Tc)^2/Pc*(1+m*(1-sqrt(Tre)))^2;
%PR EOS
P=R*T(i)./(v-b)-a./(v.*(v+b)+b*(v-b));
Pv=[Pv P'];
%plotting isotherms for T varying from 313.15 to 363.15
h=plot(v,P);
set(h,'color',rand(1,3),'linewidth',2);
hold on
axis ([0 1600 -40 60])
xlabel('volume in cm3/mol')
ylabel('pressure in bar')
title ('isotherm for propane')
end

답변 (1개)

Dennis
Dennis 2019년 5월 8일

0 개 추천

In general you are more likely to receive an answer if you describe the problem you are facing and include any error messages. In this case 'Undefined function or variable 'Pv'.', caused by
Pv=[Pv P'];
To fix it you need to declare Pv before using it.
Tc=369.9;
Pc=42.0;
Omega=0.152;
%%
%universal gas constant
R=83.14;
% b and m for the PR EOS
b=0.7780*R*Tc/Pc;
m=0.37464+1.54226*Omega-0.26992*Omega^2;
j=1;
Pv=[];
for i=40:10:90
%molar volume
v=0.001:1:2500;
%temperature
T(i)=273.15+i;
%reduced temperature
Tre=T(i)/Tc;
%a for the PR EOS
a = 0.45724*(R*Tc)^2/Pc*(1+m*(1-sqrt(Tre)))^2;
%PR EOS
P=R*T(i)./(v-b)-a./(v.*(v+b)+b*(v-b));
%plotting isotherms for T varying from 313.15 to 363.15
h=plot(v,P);
set(h,'color',rand(1,3),'linewidth',2);
hold on
axis ([0 1600 -40 60])
xlabel('volume in cm3/mol')
ylabel('pressure in bar')
title ('isotherm for propane')
end

카테고리

도움말 센터File Exchange에서 Chemistry에 대해 자세히 알아보기

태그

답변:

2019년 5월 8일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by