Plotting two different dimensions time series data on the same x-axis

12 ビュー (過去 30 日間)
Monsef Tahir
Monsef Tahir 2019 年 6 月 11 日
コメント済み: Peter Perkins 2019 年 6 月 19 日
Hi community
I have two time series vectors e,g x1=24 and x2=0:96. The represent hourly (x1) and quarterly (x2 for 15 min) measurements in time for one day.
I would like to plot the two vectors on the same figure with x-axis as 1:00 am 3:00 am ....... 11:00 pm 12:0o pm.

採用された回答

Peter Perkins
Peter Perkins 2019 年 6 月 12 日
>> x1 = rand(1,6); t1 = datetime(2019,6,12,1:6,0,0,0);
>> x2 = rand(1,24); t2 = datetime(2019,6,12,1,(0:23)*15,0);
>> plot(t1,x1,'-o',t2,x2,'-x')
untitled.png
  2 件のコメント
Monsef Tahir
Monsef Tahir 2019 年 6 月 12 日
That is what I am looking for. However, I need the x-axis to start with 1:00 am and ends 12:00 pm, which means 24 hours. What changes should be made in the code.
Thank you,
Peter Perkins
Peter Perkins 2019 年 6 月 19 日
Use the xlim function, or set the corresponding property of the axes object.

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

その他の回答 (0 件)

カテゴリ

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