time series plot
Show older comments
I am trying to plot tidal level over time, but am struggling to get the date and time accurately along the X-axis. The time data is currently in a date vector format of 6 columns [dd mm yy hh mm ss]. What is the best way to convert this data into a format which can be plotted on the x-axis against water level? The matrix lengths are the same. Cheers!
Answers (3)
Wayne King
on 25 May 2012
Did you use datenum and datetick?
t = (1900:10:1990)'; % Time interval
p = [75.995 91.972 105.711 123.203 131.669 ...
150.697 179.323 203.212 226.505 249.633]'; % Population
plot(datenum(t,1,1),p) % Convert years to date numbers and plot
datetick('x','yyyy') % Replace x-axis ticks with 4 digit year labels.
Jamie
on 25 May 2012
0 votes
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!