Problem with plotting a function on a specified domain

1 次查看(过去 30 天)
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 ?

采纳的回答

Ameer Hamza
Ameer Hamza 2018-6-10
You also need to specify x variable for plot. Try
plot(t, z(:,3))

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by