plotting data which extends several years

1 vue (au cours des 30 derniers jours)
Richard
Richard le 10 Avr 2012
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.

Réponses (1)

dk
dk le 10 Avr 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')

Catégories

En savoir plus sur Dates and Time dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by