How to plot variables with different array sizes?

17 ビュー (過去 30 日間)
Garrett
Garrett 2022 年 4 月 14 日
編集済み: the cyclist 2022 年 4 月 14 日
I'm trying to plot three different trajectory curves (altitude with respect to time), but each of the three curves has a different array size:
t1 = 1x13462 double, Y1 = 1x13462 double
t2 = 1x7041 double, Y2 = 1x7041 double
t3 = 1x31203 double, Y3 = 1x31203 double
I want to plot all these on the same plot, with t on the x-axis and Y on the y-axis. Is there any way to do this without plotting them individually in subplots? Thanks!

採用された回答

Voss
Voss 2022 年 4 月 14 日
plot(t1,Y1)
hold on
plot(t2,Y2)
plot(t3,Y3)

その他の回答 (2 件)

the cyclist
the cyclist 2022 年 4 月 14 日
編集済み: the cyclist 2022 年 4 月 14 日
Here is one way:
figure
hold on
plot(t1,Y1)
plot(t2,Y2)
plot(t3,Y3)
Another is:
figure
plot(t1,Y1,t2,Y2,t3,Y3)

mark li
mark li 2022 年 4 月 14 日
You may :
plot(t1,Y1,t2,Y2,t3,Y3)
Otherwise,
plot(t1,Y1)
hold on
plot(t2,Y2)
plot(t3,Y3)

カテゴリ

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