フィルターのクリア

Problem with plotting a function on a specified domain

1 回表示 (過去 30 日間)
Cris19
Cris19 2018 年 6 月 10 日
コメント済み: Ameer Hamza 2018 年 6 月 10 日
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))
  2 件のコメント
Cris19
Cris19 2018 年 6 月 10 日
Indeed with the command (t, z(:,3)) it worked. Thank you !
Ameer Hamza
Ameer Hamza 2018 年 6 月 10 日
You are welcome.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by