resampleの結果について

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

Risposte (1)

Hernia Baby
Hernia Baby il 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 Commento
Kazu Ari
Kazu Ari il 8 Mag 2022
ありがとうございます。
interp1で試してみます。

Accedi per commentare.

Tag

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!