Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How to have several plots with decreasing data in x direction for each plots

1 回表示 (過去 30 日間)
yasmine benrokia
yasmine benrokia 2017 年 4 月 21 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hi Guys,
I have 4 plots to make them fit in one graph, basically those plots are from a bench of output data. Those data, in y or x have the same physical properties as in x(timeSteps) and y(flamePosition). As an exemple, plot1 has: X1=(1,2,3,4,5,6,7,8,9,10) y1=(2,4,6,8,3,7,4,1,9,4), plot2(the number of time steps is less) X2=(1,2,3,4,5,6) y2=(1,1,7,8,3,7), plot3 X3=(1,2,3,4) y3=(2,2,7,5), plot4 X4=(1,2,3) y4=(4,5,9),
How i could have them all in one plot by considring the same x direction (the same number of data points), or is there a another way to approach the problem?,
Thanks

回答 (1 件)

Ankit Bhardwaj
Ankit Bhardwaj 2017 年 4 月 24 日
Assuming you have the following data.
>> X1=[1,2,3,4,5,6,7,8,9,10];
>> Y1=2*X1;
>> X2 = [1,2,3,4,5,6,7,8,9];
>> Y2 = 3*X2;
In general, you can use 'hold on' to plot multiple lines on a single axis. For instance, the following command will draw two lines with different number of data points on the same axis.
>> plot(X1,Y1)
>> hold on
>> plot(X2,Y2)
Alternately, in this particular case you can just use the following command as well.
>>plot(X1,Y1,X2,Y2)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by