resampleの結果について

15 views (last 30 days)
Kazu Ari
Kazu Ari on 28 Apr 2022
Commented: Kazu Ari on 8 May 2022
不等間隔データのresampleコマンドを使ったところ、データの最後の方が発散してしまいました。
発散しないようにするオプションはありますでしょうか?
青色が元のデータ、それ以外がサンプリング周波数を変えてresampleした結果です。
よろしくお願いいたします。re

Answers (1)

Hernia Baby
Hernia Baby on 28 Apr 2022
線形シーケンスのリサンプリング の説明では以下のように書かれてます。
---------
フィルター処理の際、resample は、この関数に与えられたサンプルの範囲外では、入力シーケンス x をゼロと見なします。
x の両端でゼロから大きく逸脱すると、y の値が予期しないものになることがあります。
---------
ですのでここは interp1 がよろしいのではないでしょうか?
fs = 10;
t1 = 0:1/fs:1;
x = t1;
y = resample(x,3,2);
t2 = (0:(length(y)-1))*2/(3*fs);
% 線形補間
y2 = interp1(x,t1,t2);
plot(t1,x,'*',t2,y,'o',t2,y2,'squarek')
xlabel('Time (s)')
ylabel('Signal')
legend('Original','Resampled','Interporation', ...
'Location','NorthWest')
  1 Comment
Kazu Ari
Kazu Ari on 8 May 2022
ありがとうございます。
interp1で試してみます。

Sign in to comment.

Tags

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!