필터 지우기
필터 지우기

Plot time series data in MATLAB

조회 수: 3 (최근 30일)
Chayan Roychoudhury
Chayan Roychoudhury 2018년 5월 11일
답변: Cathal Cunningham 2018년 5월 11일
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
Chayan Roychoudhury 2018년 5월 11일
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