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:
[n_LPF, Wn_LPF] = buttord(Wp_LPF, Ws_LPF, Rp, Rs);
[b_LPF, a_LPF] = butter(n_LPF, Wn_LPF, 'low');
freqz(b_LPF, a_LPF, 2^16, Fs);
title('BPF1: Butterworth Lowpass Filter (≤1000 Hz)');
xlabel('Frequency (Hz)'); ylabel('Magnitude (dB)');
[n_HPF, Wn_HPF] = buttord(Wp_HPF, Ws_HPF, Rp, Rs);
[b_HPF, a_HPF] = butter(n_HPF, Wn_HPF, 'high');
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!