Nan and Inf with butterworth filter
64 次查看(过去 30 天)
显示 更早的评论
- I want to create a butterworth filter of order 10 to extract thewaves having frequency between 8-30Hz.
- The signal which I want to filter has been sampled at 512Hz.
- This is how I am using creating and using my filter.
[b,a] = butter(10, [8/256 30/256], 'bandpass')
filt=filter(b,a,series1);
But I get inf and NaN values. So I wanted to know am I using it correctly? Any tips and pointers will help Thanks in adavance
0 个评论
回答(2 个)
Star Strider
2014-5-11
First, see if a lower-order filter works. Use the freqz function to analyse it before you use it on your data.
Second, see what the results of these commands are:
ser1nan = length(find(isnan(series1)))
ser1inf = length(find(isinf(series1)))
If they’re not both zero, you have to figure out what you want to do with the NaN and Inf values.
2 个评论
Star Strider
2014-5-12
Please upload your input data as a single-column text file. The file ‘ip.txt’ is your input as a multi-line row vector copied from the Command Window.
Honglei Chen
2014-5-12
If your signal does not contain nan or inf, then likely this is due to the numerical stability of transfer function designed by butter algorithm. You can try the following code to design a Butterworth filter in SOS form, which improves the the numerical robustness and see if it addresses your issue.
myFilter = design(fdesign.bandpass('N,F3dB1,F3dB2',6,8,30,500),'butter');
y = filter(hd,series1);
HTH
2 个评论
Harshavardhan Vijaya Kumar
2018-3-19
I am facing a similar issue with the butterworth filter. I am a Researcher using Matlab for Noise Analysis, The filter appears to behave highly abnormal at low frequency bandwidths, Will the SOS form of Butterworth filters be any better ? I have just started learning matlab. Please Advice
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!