Why I cannot see any result on my graph

1 回表示 (過去 30 日間)
Berk Han
Berk Han 2022 年 6 月 14 日
編集済み: Voss 2022 年 6 月 15 日
clc
clear all
sympref('FloatingPointOutput',true)
syms X(t)
syms S1(t)
syms S2(t)
syms B1(t)
x=1
L=1
t1=0
kd=0.076
Bmax=15.658
ib=0.616
K1=171.492
Umaxg=0.730
Ksg=1.293
Ksx=4.469
Umaxx=0.615
SG=31
SGn=SG %g/l
SX=32 %g/l
B=0 %g/l
x0=0.01 %g/l
Xn=x0 %g/l
Yxsg=0.523
Yxsx=0.058
Ybsg=1.196
Ybsx=0.232
Ybxg=Ybsg/Yxsg
Ybxx=Ybsx/Yxsx
Usg=(Umaxg*SG)/((Ksg+SG)*((1+SX)/Ksx))
Usx=(Umaxx*SX)/((Ksx+SX)*((1+SG)/Ksg))
Ug=(Usg+Usx)*(K1/(K1+SG+SX))*(1-(B/Bmax))^(ib)
Unet=Ug-kd
ode = diff(X,t)==Unet*X;
cond=X(t1)==Xn;
XSol(t)=dsolve(ode,cond)
ode = diff(S1,t)== -Usg*((1/Yxsg)+(1/Ybsg))*XSol;
cond= S1(t1)==SGn;
SGsol(t)=dsolve(ode,cond)
ode = diff(S2,t)== -Usx*((1/Yxsx)+(1/Ybsx))*XSol;
cond= S2(t1)==SGn;
SXsol(t)=dsolve(ode,cond)
ode = diff(B1,t)== (Usg*Ybxg+Usx*Ybxx)*XSol;
cond= B1(t1)==B
Bsol(t)=dsolve(ode,cond)
for i=0:10:300
XSol(i);
SGsol(i) ;
SXsol(i);
Bsol(i);
end
plot(i,SXsol(i))

採用された回答

Voss
Voss 2022 年 6 月 14 日
Instead of this:
plot(i,SXsol(i))
try this:
fplot(SXsol,[0 300])
or this:
t_plot = 0:10:300;
plot(t_plot,SXsol(t_plot))
  2 件のコメント
Berk Han
Berk Han 2022 年 6 月 14 日
Thank you!
fplot(SXsol,[0 300]) is working in my code.
Voss
Voss 2022 年 6 月 14 日
編集済み: Voss 2022 年 6 月 15 日
You're welcome!

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

その他の回答 (1 件)

Cris LaPierre
Cris LaPierre 2022 年 6 月 14 日
By default, MATLAB plots using a solid line style with no marker. When you plot a single point like your code is doing, this results in your point not being visible.
If you truly want to plot the ith point, then add a marker style.
plot(i,SXsol(i),'o')
If you instead want to plot all your data, remove i.
plot(SXsol)
  2 件のコメント
Berk Han
Berk Han 2022 年 6 月 14 日
Thanks but plot(SXsol) didnt work.
Cris LaPierre
Cris LaPierre 2022 年 6 月 14 日
編集済み: Cris LaPierre 2022 年 6 月 14 日
I overlooked that SXsol was a symfun. Use one of the solutions described by Voss.

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

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by