Filter löschen
Filter löschen

Plot time series data in MATLAB

3 Ansichten (letzte 30 Tage)
Chayan Roychoudhury
Chayan Roychoudhury am 11 Mai 2018
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 Kommentare
dpb
dpb am 11 Mai 2018
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
Chayan Roychoudhury am 11 Mai 2018
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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Cathal Cunningham
Cathal Cunningham am 11 Mai 2018
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)

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!

Translated by