plotting data which extends several years
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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.
0 Kommentare
Antworten (1)
dk
am 10 Apr. 2012
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')
0 Kommentare
Siehe auch
Kategorien
Mehr zu Dates and Time finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!