Low Pass Filter returning NaN
12 ビュー (過去 30 日間)
古いコメントを表示
New user, here...
I'm trying to use a LPF on an array with data from a sensor. The sampling rate of the data is either 375/sec or 500/sec. The samples are between 1000/-1000.
I was successfully using the following script on one set of data:
%Low Pass Filter
f=500;
fNormLow = 2/(f/2);
[b1,a1] = butter(2,fNormLow,'low');
lowPass = filtfilt(b1,a1,rawData(:,1));
figure(3);
plot(lowPass(:,1),'-m')
hold on;
However, the same script doesn't work on a different set of data. lowPass(:,1) is entirely filled with NaN.
Can anyone lend some insight as to what I'm doing wrong? I'm thinking I need to try a FIR filter instead of an IIR, but I'm not sure why it works for the first set of data and not for the second. If the answer is a different filter, I'm hoping for a suggestion of which one to use. I'm looking for a very smooth sine wave to be made out of data with a periodic spike - pretty simple. Maybe someone could post an example?
Thanks in advance!
2 件のコメント
Honglei Chen
2011 年 6 月 14 日
You may want to check your raw data and see if it has things like NaN or Inf in there.
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Digital and Analog Filters についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!