Plot time series data in MATLAB

3 次查看(过去 30 天)
I have to plot a time series data in MATLAB. The Y axis is a parameter taken six hourly for each day in a certain month of the year. And 44 such years have been taken into account. From 1958 to 2001. So the points on the X axis are 4*31*44=5456. How can I plot the data efficiently in MATLAB? The data file has two column vectors. I have to plot the x axis so that it shows 44 July s from 1958 to 2001 . Each July has 124 points. One for the time points (5456 points) so 5456 rows and other for the parameter measured. Thanks a lot.
  2 个评论
dpb
dpb 2018-5-11
Show us specifically
  1. what the time data storage is and
  2. explain how you want the forty-four months of data shown -- serially as above just labelled by year or as multiple lines (44 of 'em) as yearly observation on calendar axis Jul 1-->July 31 or something else entirely?
Chayan Roychoudhury
The time data storage isnt explicit. The data file has two columns- the first containing the time points as a serial number from 1 to 5456 and the other column with the parameter values.
I want the x axis showing July of each of the 4 years. And each July will have 124 data points.

请先登录,再进行评论。

回答(1 个)

Cathal Cunningham
Cathal Cunningham 2018-5-11
You could try something like this:
yrs = [1958:1:2001];
lbls = cell(numel(yrs),1);
for i = 1:numel(yrs)
lbls{i} = sprintf('July %d',yrs(i));
end
figure
time = 1:4*31*numel(yrs);
data = randi(50,1,length(time));
plot(time,data)
set(gca,'XTick',[1:4*31:4*31*numel(yrs)])
set(gca,'XTickLabel',lbls)
xtickangle(gca,45)

类别

Help CenterFile Exchange 中查找有关 Calendar 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by