フィルターのクリア

plotting data which extends several years

1 回表示 (過去 30 日間)
Richard
Richard 2012 年 4 月 10 日
Consider the following example:
clear all
time_2007 = linspace(1+0.0417, 366, (366-1)*24);
time_2008 = linspace(1+0.0417, 367, (367-1)*24);
data_2007 = 1 + (20-1).*rand(8760,1);
data_2008 = 1 + (20-1).*rand(8784,1);
time = [time_2007,time_2008];
data = [data_2007',data_2008'];
plot(time,data);
Here time is given in decimal day. By plotting the time series the data currently overlap each other due to the similarity of the decimal days. How is it possible to plot this as a time series i.e. showing the data as it progresses from one year to the next so starting from January 2007 and finishing at December 2008. Please note that I am trying not to use the time series function provided.
I was considering converting the decimal days into julian days but was unsure on ow to make this more interpretable after plotting.

回答 (1 件)

dk
dk 2012 年 4 月 10 日
Try one of these
time = [time_2007,time_2008+365];
plot(time,data);
or
time=[datenum('2007,1,1')+time_2007,datenum('2008,1,1')+time_2008];
figure,plot(time,data);
datetick('x','mmmyy')

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by