Problem with plotting a function on a specified domain
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Cris19
am 10 Jun. 2018
Kommentiert: Ameer Hamza
am 10 Jun. 2018
I am trying to plot the solution of a system of ODEs. The code is:
tspan = [0 10];
z0 = [0.01 0.01 0.01 0.01];
[t,z] = ode45(@(t,z) odefun3(t,z), tspan, z0);
plot(z(:,3))
Why the output is plotted on the interval [0,60] and not on [0,10], as in the code ?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/191168/image.bmp)
0 Kommentare
Akzeptierte Antwort
Ameer Hamza
am 10 Jun. 2018
You also need to specify x variable for plot. Try
plot(t, z(:,3))
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!