[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
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.
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);