필터 지우기
필터 지우기

How to resample a timeseries to unique interval?

조회 수: 1 (최근 30일)
Bedanta
Bedanta 2012년 9월 13일
I have a file which contains the following information in its columns: YYYY MM DD H MIN S X Y Z
The time increment is in seconds, but the interval is not constant. Sometimes it is 3s and sometimes 2s and occassionally 10s.
Can I use some command to have a matrix with constant time intervals and all other values interpolated (in case they are missing)?

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2012년 9월 13일
편집: Azzi Abdelmalek 2012년 9월 13일
my=cellstr(datestr(datenum(2010,1,1,1,1,(1:24*1)),'yy/mm/dd HH:MM:SS'))
%my is your date cell array
time_v=datevec(my);n=size(time_v,1);
x=rand(n,1); % example: x y z your data
y=rand(n,1);
z=rand(n,1);
du=etime(time_v(end,:),
time_v(1,:))
i_s=time_v(1,6);
y0=time_v(1,1);
m0=time_v(1,2);
d0=time_v(1,3);
h0=time_v(1,4);
min0=time_v(1,5);
new_time=datevec(datestr(datenum(y0,m0,d0,h0,min0,(i_s:i_s+du)),'yy/mm/dd HH:MM:SS'))
method='linear'
newt=new_time(:,6);
t=time_v(:,6);
new_x=interp1(t,x,newt,method)
new_y=interp1(t,y,newt,method)
new_z=interp1(t,z,newt,method)
  댓글 수: 1
Bedanta
Bedanta 2012년 9월 14일
I think it gives me a head start to how I should approach, but is not really the answer that I was looking. I forgot to mention that the increment I am seeking is constant 2s. I should hopefully be able to work it out from here. Thanks!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by