MATLAB Answers

How to plot ode

1 view (last 30 days)
Ana Rasic
Ana Rasic on 25 Nov 2020
Edited: Ana Rasic on 26 Nov 2020
I will need a help.So,I have 4 different variables

Accepted Answer

Alan Stevens
Alan Stevens on 25 Nov 2020
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 Comments
Ana Rasic
Ana Rasic on 26 Nov 2020
Right, I understand:)

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by