23BEC021 DSP Exp 5
23BEC021 DSP Exp 5
Title : Design simple digital filters using Z-transform and pole-zero analysis.
b) Write a program to compute and display the poles and zeros using zplane(), to
compute and display the factored form, and to generate the pole-zero plot of given
transfer function in Eq. (1).
Code:p
clc;clear all;close all;
num = [2,5,9,5,3];
den = [5,45,2,1,1];
[h,w]= freqz(num,den);
zplane(num,den);
[p,z,k] = tf2zp(num,den);
Output:
Code:
clc;clear all ; close all;
wc = 0.45*pi;
alpha = (1-sin(wc))/cos(wc);
% num1 = [1 1];
% den1 = [1 -alpha];
% num2 = [1 -1];
% den2 = [1 -alpha];
k1 = (1-alpha)/2;
k2 = (1+alpha)/2;
[num1,den1] = zp2tf(-1,alpha,k1);
[num2,den2] = zp2tf(1,alpha,k2);
[h1,w1] = freqz(num1,den1);
[h2,w2] = freqz(num2,den2);
subplot 211
plot(w1/pi,20*log10(abs(h1)));grid on;
ylabel("MAGNITUDE(dB");
xlabel("Omega(Normalized)");
title("LPF");
subplot 212
plot(w2/pi,20*log10(abs(h2)));grid on;
ylabel("MAGNITUDE(dB");
xlabel("Omega(Normalized)");
title("HPF");
Output:
d) Design a second-order IIR bandpass filter with a center frequency ω0 at 0.61π and a
3-dB bandwidth of 0.15π. Since Eq. (6) is a quadratic equation in α, there will be two
values of the parameter α yielding the same value of the 3- dB bandwidth, resulting in
two di erent expressions for the transfer function HBP (z). Using the function zplane,
develop the pole-zero plots of the two designs obtained and choose the design that
results in a stable transfer function. Using MATLAB compute and plot the gain response
of the filter you designed, and verify that it indeed meets the given specifications.
Output:
Conclusion:
In this experiment, I learned how to design and analyze digital filters using the Z-
transform and pole-zero analysis. By computing the poles and zeros of a given transfer
function, I determined filter stability and frequency response. I implemented low-pass,
high-pass, and bandpass IIR filters, observing how pole placement a ects their
behavior. The freqz() function helped visualize magnitude and phase responses, while
zplane() confirmed filter stability.