MATLAB: How to Butterworth Filter with Bandpass [10 500] with sampling rate 1000
bandpass [10 500]butterworth filter
Hi,
I want to butterworth filter with bandpass [10 500] with sampling frequency 1000 but there is an error stating "The cutoff frequencies must be within the interval of (0,1)." How do I solve this problem?
Best Answer
You have to divide your passband and stopband frequencies by the Nyquist frequency to normalise them:
[sos,g] = tf2sos(b,a); % Convert To Second-Order Sections For Stability
figure(1)
freqz(sos, 4096, Fs) % Filter Bode Plot
You cannot have any frequencyexactly at zero orexactly at the Nyquist frequency, so I designed your passband to be close enough to them to be stable. In your filter, you can also use a high-pass design with a lower cutoff of10 Hz, since your upper passband is at the Nyquist frequency. The passband and stopband ripple values are necessary to specify in the design but irrelevant to a Butterworth filter. These are acceptable values for most filter designs (for example Chebyshev) that require them.
You would use the‘sos’ and‘g’ variables in your actual filter:
filtered_signal = filtfilt(sos, g, signal);
(This design works well inR2016a and should also work in earlier releases.)
Best Answer