Assuming a sampling rate of 16kHz, design a 65-length bandstop FIR filter using
ID: 3580183 • Letter: A
Question
Assuming a sampling rate of 16kHz, design a 65-length bandstop FIR filter using frequency sampling approach with band-edges of 2kHz and 6kHz. (You will not receive any credit if you use software tools that uses filter specification and generates the filter automatically. YOU MUST provide the low level implementation of the filter and include all your code Sketch the ideal magnitude response of the filter should be. Write an expression for the filter including both magnitude and phase. Plot the magnitude of the sample values of the filter, H(k) (using the stem function). Plot the impulse response of the filter, h(n) (using the stem function).Explanation / Answer
butterworth fir bandstop filter
clc;
clear all;
rp = input('Enter the passband ripple = '); // calculate passband and stopband ripple factor
rs = input('Enter the stopband ripple = ');
wp = input('Enter the passband frequency = ');
ws = input('Enter the stopband frequency = ');
fs = input('Enter the sampling frequency = ');
w1 = 2*wp/fs;
w2 = 2*ws/fs;
[n] = buttord(w1,w2,rp,rs);
wn = [w1 w2];
[b,a] = butter(n,wn,'stop');
w = 0:0.01:pi;
[x, y] = freqz(b,a,w);
mag = 20*log10(abs(x));
ang = angle(x);
subplot(2,1,1);
plot(y /pi,mag);
subplot(2,1,1);
plot(y /pi,mag);
title('Magnitude Response');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
subplot(2,1,2);
plot(y /pi,ang);
title('Phase Response');
xlabel('Normalised Frequency ');
ylabel('Phase in radians ');
grid on;
Output:
Enter the passband ripple =
Enter the stopband ripple =
Enter the passband frequency = 2000
Enter the stopband frequency = 6000
Enter the sampling frequency = 16000
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.