フィルターのクリア

How to plot the results from dsolve matlab

37 ビュー (過去 30 日間)
Sabella Huang
Sabella Huang 2022 年 5 月 30 日
コメント済み: Sabella Huang 2022 年 5 月 30 日
Hello Guys,
I would like to ask about, how to plot the results from the dsolve equation?. Here is my code that I used
Rmax = 1410.34;
conc = 500e-9;
ka = 3.46e3;
kd = 1.46e-4;
t = linspace(0, 1800, 600)';
A = ka*conc*Rmax;
B = ka*conc;
C = kd;
syms y(t) A B C
eqn = diff(y,t) == A-B*y-C*y;
cond = y(0) == 0;
s(t) = dsolve(eqn,cond);
fplot(t(:),s)

採用された回答

Torsten
Torsten 2022 年 5 月 30 日
編集済み: Torsten 2022 年 5 月 30 日
Rmax = 1410.34;
conc = 500e-9;
ka = 3.46e3;
kd = 1.46e-4;
A = ka*conc*Rmax;
B = ka*conc;
C = kd;
syms t y(t)
eqn = diff(y,t) == A-B*y-C*y;
cond = y(0) == 0;
s(t) = dsolve(eqn,cond);
s = matlabFunction(s);
t = linspace(0, 1800, 600)';
plot(t,s(t))
  1 件のコメント
Sabella Huang
Sabella Huang 2022 年 5 月 30 日
thank you very much. It's really help me

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

その他の回答 (1 件)

Alberto Cuadra Lara
Alberto Cuadra Lara 2022 年 5 月 30 日
Hello Sabella,
I have not worked too much with symbolic, but I think this approach may solve your problem.
In case you want to plot a specific range, fplot requires specifying the interval, not the range of values.
Rmax = 1410.34;
conc = 500e-9;
ka = 3.46e3;
kd = 1.46e-4;
t_vector = linspace(0, 1800, 600);
A = ka*conc*Rmax;
B = ka*conc;
C = kd;
syms y(t)
eqn = diff(y, t) == A - B*y - C*y;
cond = y(0) == 0;
s(t) = dsolve(eqn, cond);
fplot(@(t) s(t), [t_vector(1), t_vector(end)])
  1 件のコメント
Sabella Huang
Sabella Huang 2022 年 5 月 30 日
Yes, this is a graph that I hope to get. Thank you very much. It's really help me

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by