how to write a for loop for the following task?

6 ビュー (過去 30 日間)
Ivy Shen
Ivy Shen 2018 年 9 月 16 日
コメント済み: Walter Roberson 2018 年 9 月 17 日
Known:
Kp(1)=a;
Then:
x = roots([Kp-1 7.56*Kp -18.12*Kp 9.56*Kp]); (we only need 0<x<1).
T = roots([-0.001273*x+0.00365 0.544*x+44.3191 283338.4*x-407295]);
mu_CO2 = -394088+44.3191*(T-298-T*ln(T/298))-0.0073/2*(T-298)^2-213.984*T;
mu_CO = -110700+29.6127*(T-298-T*ln(T/298))-0.00301/2*(T-298)^2-197.81*T;
mu_O2 = 30.5041*(T-298-T*ln(T/298))-0.00349/2*(T-298)^2-205.31*T;
Kp_new = exp(-(mu_O2+2*mu_CO-2*mu_CO2)/(8.314*T));
Finally, I need to use Kp_new to calculate new x, new T, new mu. The iteration number is supposed to be 20.
I will appreciate if someone can help me on this problem!
  13 件のコメント
Walter Roberson
Walter Roberson 2018 年 9 月 17 日
You should change
x(i-1) = x_root(x_root>0 & x_root<1);
to
x(i-1) = x_root(imag(x_root) == 0 & x_root>0 & x_root<1);
Walter Roberson
Walter Roberson 2018 年 9 月 17 日
Last night I tried finding the range of Kp values that left x_root in the range 0 to 1. It turned out that for 0 exactly, the solutions were 0 and 3775/7744 with that second value being an isolated real-valued spot in the middle of complex-valued Kp solutions. It also turned out that due to discontinuities, there were no finite values of Kp that made any of the x_root values exactly 1, but infinite Kp made it one (that is, the values were greater than one for finite values but converged to one at infinity.)

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

回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by