フィルターのクリア

Need help plotting results of different length of a Diff Equation Solver

1 回表示 (過去 30 日間)
Saurabh Sakpal
Saurabh Sakpal 2015 年 8 月 27 日
編集済み: John D'Errico 2015 年 8 月 27 日
Hey everyone, As my title sugggests i need help plotting a DE solver result in a for loop. Problem is every iteration is different length to the last one, for eg, one might be 45 long, the other is 48, and i have to plot these different iterations on the same graph.
OK this is what the general problem looks like
for i = 1:n
[t,x] = ode23(t0, x0)
end
I have to plot all the x's for N iterations on the same graph vs time. But all the x's outputting are different lengths. How do i solve this problem?
Much appreciated.

回答 (1 件)

John D'Errico
John D'Errico 2015 年 8 月 27 日
編集済み: John D'Errico 2015 年 8 月 27 日
By putting a plot statement inside the loop? The hold command may be of use for you.
for i = 1:n
[t,x] = ode23(t0, x0);
hold on
plot(t,x)
end
Other ways too, but this is the obvious.

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by