Low Pass Filter returning NaN
조회 수: 13 (최근 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!