Trying to graph two differential equations on same plot

1 回表示 (過去 30 日間)
Rodrigo Blas
Rodrigo Blas 2020 年 3 月 19 日
コメント済み: Rodrigo Blas 2020 年 3 月 22 日
T1=50+273.15; %%k
T2=127+273.15; %%k
Fao=2.5; %%mol/min
P=10; %%atm
k1=10^-4; %%min^-1
R=8.314; %j/k*mol
R1=8.206*10^-5*1000; %%atm*dm^3/K*mol
E=85*1000; %%j/mol
k2=k1*exp(E/R*(1/T1-1/T2)); %%min^-1
cao=P/(T2*R1); %%mol/dm^3
ep=2+1-1;
xf=.90;
alpha=.001; %%dm^3
volcstr=(Fao*xf)*(1+ep*xf)/(k2*cao*(1-xf)); %%dm^3
fun=@(x) Fao/(cao*k2)*(1+ep*x)./(1-x);
volpfr=integral(fun,0,xf); %%dm^3
[x,y]=ode45(@(x,y) jallohwfun7(alpha,ep,xf,y,cao,k2,Fao),[0 500],[0 1]);
plot(x,y(:,1),'r','LineWidth',1);
hold on;
plot(x,y(:,2),'k','LineWidth',1);
legend('Pressure', 'Conversion');
xlabel('Volume [dm^3]');
ylabel('Pressure [atm] & Conversion');
title('Pressure and Conversion vs Volume ');
function dydt=jallohwfun7(alpha,ep,xf,y,cao,k2,Fao)
dydt=zeros(2,1);
dydt(1)=-alpha*(1+ep*xf)/2*y(1);
dydt(2)=k2*cao/Fao*(1-y(2))/(1+ep*y(2));
end
I want to graph two differential equations on same graph however i keep getting a straight line for both equations, which is incorrect.

採用された回答

David Goodmanson
David Goodmanson 2020 年 3 月 19 日
Hi Rodrigo,
you have the following:
function dydt=jallohwfun7(alpha,ep,xf,y,cao,k2,Fao)
dydt=zeros(2,1);
dydt(1)=-alpha*(1+ep*xf)/2*y(1);
dydt(2)=k2*cao/Fao*(1-y(2))/(1+ep*y(2));
end
with initial conditions y(1) = 0, y(2) = 1. Plugging those in gives dy/dt(1) = 0, dy/dt(2) = 0 so the system never gets off the schneid. It just stays in the initial state.
  1 件のコメント
Rodrigo Blas
Rodrigo Blas 2020 年 3 月 22 日
Thank you for your help!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by