Conversion of time series- hour resolution to minute resolution!

조회 수: 4 (최근 30일)
Ashish
Ashish 2014년 8월 26일
댓글: Ashish 2014년 8월 26일
I have a time series of '1' and '0' representing accessibility of the system. Each index of the time series represents an hour (resolution).
Now, instead of having accessibility each hour, I want it for each 6 minutes. To explain the thing I want to achieve, I shall give an example:
  • E.g. at 00.00 hrs, the value of accessibility is '1' and at 01.00 hrs, the accessibility goes to '0'. The new vector should consider the following- from 00.06 - 00.30 hrs(5 indices), the value will be '1' and from 00.36 - 1.00 hrs (5 indices) the value is '0'.
How should I formulate a new vector, which could do such an operation?

채택된 답변

Patrik Ek
Patrik Ek 2014년 8월 26일
편집: Patrik Ek 2014년 8월 26일
You can use repmat
t0 = [1,0,0,1]; % [00.00, 01.00, 02.00, 03.00]
t1tmp = repmat(t0,10,1); % repeat rows 10 times
t1tmp = t1tmp(:).'; % Make t1tmp a row vector
t1 = t1(6:end.6); % remove times 23.30-00.00 and 03.00-03.30
  댓글 수: 1
Ashish
Ashish 2014년 8월 26일
Thanks Patrik.
The last line shows error. Also, I didn't understand as to what is to be achieved with that line?

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

추가 답변 (1개)

dpb
dpb 2014년 8월 26일
편집: dpb 2014년 8월 26일
>> round(interp1([0 1],[0 1],0:.1:1))
ans =
0 0 0 0 0 1 1 1 1 1 1
>>
Generalize to
x=0:length(series)-1;
y=series;
interpolatedseries=round(interp1(x,y,[0:0.1:x(end)]));
This is in units of hours, of course. If want minutes multiply x by 6 or in actual time, convert to Matlab datenums.

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by