plotting data which extends several years
1 view (last 30 days)
Show older comments
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 Comments
Answers (1)
dk
on 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 Comments
See Also
Categories
Find more on Dates and Time in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!