フィルターのクリア

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 Center および File ExchangeMultirate Signal Processing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by