How to plot ode

1 回表示 (過去 30 日間)
Ana Rasic
Ana Rasic 2020 年 11 月 25 日
編集済み: Ana Rasic 2020 年 11 月 26 日
I will need a help.So,I have 4 different variables

採用された回答

Alan Stevens
Alan Stevens 2020 年 11 月 25 日
First, you should combine your three "prom" ode functions into one
IC = [n0 m0 h0];
[t, NMH] = ode45(@(t,nmh) prom(t,nmh,V1), tspan, IC);
n = NMH(:,1):
m = NMH(:,2);
h = NMH(:,3);
...
where your ode function is something like
function dNMHdt = prom(t,NMH,V1)
n = NMH(1);
m = NMH(2);
h = NMH(3);
dndt = ....;
dmdt = ....;
dhdt = ....;
dNMHdt [ dndt; dmdt; dhdt];
end
Then you can think of doing something along the lines of:
V1 = [20 40 60 80];
for i = 1:4
[t, NMH] = ode45(@(t,nmh) prom(t,nmh,V1(i)), tspan, IC);
n(:,i) = NMH(:,1);
m(:,i) = ....etc.
end
  4 件のコメント
Alan Stevens
Alan Stevens 2020 年 11 月 26 日
It saves the values of NMH for that value of i (if I've got the syntax right!) so that you can plot/display/examine all four sets of values after the loop is completed. Similarly for m and h.
Ana Rasic
Ana Rasic 2020 年 11 月 26 日
Right, I understand:)

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by