butterworth band pass filter
Show older comments
can you tell me how to apply a butterworth bandwith filter which only allows frequency of 0.5-25hz where sampling frequency is 1000 samples per second to a signal .
1 Comment
Mehmed Saad
on 13 May 2020
see here
Answers (1)
Star Strider
on 13 May 2020
Try this:
Fs = 1000; % Sampling Frequency (Hz)
Fn = Fs/2; % Nyquist Frequency (Hz)
Wp = [1 25]/Fn; % Normalised Passband (Passband = 1 Hz To 25 Hz)
Ws = [0.5 35]/Fn; % Normalised Stopband (Passband = ½ Hz To 35 Hz)
Rp = 1; % Passband Ripple/Attenuation
Rs = 60; % Stopband Ripple/Attenuation
[n,Wn] = buttord(Wp, Ws, Rp, Rs); % Calculate Filter Optimum Order
[z,p,k] = butter(n, Wn,'bandpass'); % Create Filter
[sos,g] = zp2sos(z,p,k); % Second-Order-Section For Stability
figure
freqz(sos, 2^26, Fs)
That is a (reasonably) complete way to design filters using the individual function syntax.
4 Comments
Udit Narayan
on 14 May 2020
Star Strider
on 14 May 2020
Udit Narayan
on 14 May 2020
Edited: Udit Narayan
on 14 May 2020
Star Strider
on 14 May 2020
Yes.
Use ‘sos’ and ‘g’ as:
y_filt = filtfilt(sos, g, y);
.
Categories
Find more on Digital Filter Design in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!