1D Interpolation of a signal - beginners question

11 ビュー (過去 30 日間)
Christoph Bauer
Christoph Bauer 2012 年 3 月 16 日
Hello everyone,
I have a beginners question about 1D interpolation of a signal. I have a system which is supposed to be sampled at 65 Hz but we found that the sampling rate is not constant and varies between 55-65 Hz. For further analysis I want to interpolate the data to have a signal with constant intervals between the data points. I used the following code but it seems not appropriate as it does not work properly.
y=signal(1,1).L1.Q(1:2982,1); %this is an example signal
ly=length(y);
x=0:ly-1;
lx=length(x);
li=ly\lx;
xi=0:li:lx;
yi=interp1(x,y,xi,'cubic');
plot(x,y,'o',xi,yi)
Could someone show me how to interpolate this signal so I get a signal with a constant sampling rate?
Thank you very much.

採用された回答

Christoph Bauer
Christoph Bauer 2012 年 3 月 21 日
y=signal(1,1).L1.Q; %this is an example signal
x=signal(1,1).L1.Elapsed;
xi=0:0.02:max(x);
yi=interp1(x,y,xi,'spline');
plot(x,y,'o',xi,yi)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by