plotting two data sets with different number of data point against one time series x axis

9 ビュー (過去 30 日間)
Lia Kirtadze
Lia Kirtadze 2022 年 2 月 5 日
回答済み: Voss 2022 年 2 月 5 日
I have two data sets
first data set consists of 86 400 elements because it is taken in every seconds
second data set is the same data set but taken in every minute therefore its number is less and equals to 1440
is there any way to plot those two data sets against one x axis which contains time corresponding to first data set
thank you in advance

回答 (1 件)

Voss
Voss 2022 年 2 月 5 日
% generate some random data for demonstration:
% second data:
data_1 = randn(86400,1)+(1:86400).'/40000;
% minute data:
data_2 = mean(reshape(data_1,60,[]),1).';
% pick a number between 0 and 60 to adjust how they line up:
second_offset = 30;
% plot:
figure();
plot(data_1);
hold on
plot((1:numel(data_2))*60-second_offset,data_2,'LineWidth',2);

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by