How can I design Butter-worth band-pass with maximum pass-band ripple of 3 dB and with maximum pass-band ripple of 40 dB

2 views (last 30 days)
I have to make two:
  1. BPF1: allows the lower frequency to pass, and kills the higher frequency
  2. BPF2: allows the higher frequency to pass, and kills the lower frequency
I made the body of the code, but what is the values of parameters " wp & ws " to make BPF1 & BPF2
%% BPF-1 Low pass
Fs=8000;
Fn=Fs/2; %Nyquist Frequency (Hz)
Wp = [1000 2000]/Fn; % Passband Frequency(Normalised)
Ws = [500 2500]/Fn; % Stopband Frequency
Rp = 3; % Passband Ripple (dB)
Rs = 40; % Stopband Ripple (dB)
[n,Wn] = buttord(Wp,Ws,Rp,Rs) % Filter Order
[z,p,k] = butter(n,Wn); % Filter Design
[sos,g] = zp2sos(z,p,k); % Convert To Second-Order-Section For Stability
freqz(sos,2^16,Fs) % Filter Bode Plot
title(sprintf('n = %d Butterworth Bandpass Filter',n))

Answers (1)

AR
AR on 17 Jun 2025
Edited: AR on 17 Jun 2025
Given the requirements, lowpass (BPF1) and highpass (BPF2) filters are the most suitable choices. To determine the passband (Wp) and stopband (Ws) frequencies for BPF1 and BPF2, follow these steps:
1.Sampling Frequency:
  • Fs = 8000 Hz
  • Nyquist Frequency (Fn) = Fs / 2 = 4000 Hz
2.Frequency Normalization:
MATLAB functions such as “buttord” and “butter” require frequencies to be normalized between 0 and 1, where 1 corresponds to Fn (4000 Hz). To normalize a frequency value, divide it by Fn.
a) For BPF1:
  • Wp = 1000 Hz / 4000 Hz = 0.25
  • Ws = 2000 Hz / 4000 Hz = 0.5
b) For BPF2:
  • Wp = 2000 / 4000 = 0.5
  • Ws = 1000 / 4000 = 0.25
Here is the additional code to be included in the original description:
% Lowpass Filter (BPF1: Allows ≤1000 Hz)
Wp_LPF = 1000 / Fn; % Passband edge (normalized)
Ws_LPF = 2000 / Fn; % Stopband edge (normalized)
[n_LPF, Wn_LPF] = buttord(Wp_LPF, Ws_LPF, Rp, Rs);
[b_LPF, a_LPF] = butter(n_LPF, Wn_LPF, 'low');
% Plot LPF
figure;
freqz(b_LPF, a_LPF, 2^16, Fs);
title('BPF1: Butterworth Lowpass Filter (≤1000 Hz)');
xlabel('Frequency (Hz)'); ylabel('Magnitude (dB)');
% Highpass Filter (BPF2: Allows ≥2000 Hz)
Wp_HPF = 2000 / Fn; % Passband edge (normalized)
Ws_HPF = 1000 / Fn; % Stopband edge (normalized)
[n_HPF, Wn_HPF] = buttord(Wp_HPF, Ws_HPF, Rp, Rs);
[b_HPF, a_HPF] = butter(n_HPF, Wn_HPF, 'high');
% Plot HPF
figure;
freqz(b_HPF, a_HPF, 2^16, Fs);
title('BPF2: Butterworth Highpass Filter (≥2000 Hz)');
xlabel('Frequency (Hz)'); ylabel('Magnitude (dB)');
If you specifically want bandpass behaviour (allowing a middle frequency band while blocking both lower and higher frequencies), use the below parameters:
a) BPF1 (Low-Centre Bandpass Filter)
  • Passband (Wp): [900, 1100] / Fn
  • Stopband (Ws): [500, 1500] / Fn
b) BPF2 (High-Centre Bandpass Filter)
  • Passband (Wp): [1900, 2100] / Fn
  • Stopband (Ws): [1500, 2500] / Fn
For more information on the functions used, please refer to the documentations below:
I hope this helps!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!