필터 지우기
필터 지우기

change the resolution of time series from hourly to 30min

조회 수: 4 (최근 30일)
Christina
Christina 2011년 9월 1일
Hello all!
I've got some hourly data and I want to transpose it to 30min data.
For example for the variable 1, I've got the timeseries: (Dates - Values:)
00:00 01/07/2010 -> 5
01:00 01/07/2010 -> 6
02:00 01/07/2010 -> 8
and I need to transpose it to: (Dates - Values)
00:00 01/07/2010 -> 5
00:30 01/07/2010 -> 5
01:00 01/07/2010 -> 6
01:30 01/07/2010 -> 6
02:00 01/07/2010 -> 8
02:30 01/07/2010 -> 8
Do you have any idea??

채택된 답변

Fangjun Jiang
Fangjun Jiang 2011년 9월 1일
resample() would be the function to use, but in your case, just process your original data to create a new timeseries.
Data=[5 6 8];
Time={'00:00 01/07/2010','01:00 01/07/2010','02:00 01/07/2010'};
ts=timeseries(Data',Time')
NewData=repmat(Data,2,1);
NewTime=datenum(Time);
NewTime=[NewTime';NewTime'+0.5/24];
NewTs=timeseries(NewData(:),NewTime(:))
  댓글 수: 2
Christina
Christina 2011년 9월 2일
Hey!
Thanks for answering.
However, with the repmat command the vector Data = [5 ;6; 8] is repeated and it becomes [5 ;6 ;8; 5 ;6 ;8]
whereas I want it to become [5; 5; 6; 6; 8; 8]
Do you know how this can be done?
Fangjun Jiang
Fangjun Jiang 2011년 9월 2일
In my code above, Data=[5 6 8] is a row vector, not a column vector as you just mentioned Data=[5;6;8].
If you have Data=[5;6;8], you can do NewData=[Data Data]';NewData=NewData(:); you'll get what you want.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Time Series Events에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by