You are on page 1of 16

MAPÚA INSTITUTE OF TECHNOLOGY

SCHOOL OF EE-ECE-CoE
INTRAMUROS, MANILA

SIGNALS SPECTRA, AND SIGNAL PROCESSING


LABORATORY
Module No.: __4__
Familiarization of Infinite Impulse Response (IIR) and Pole-Zero Response Filter

October 7, 2020 _ October 7, 2020


DATE PERFORMED D A T E SU B M I T T E D

Name: Nagayo, Paolo Manuel A.


Course/Sec: ECE107L/B4
Grade
1.) Using Butterworth filter, design a low pass filter with a sampling rate of 30,000 Hz and a cutoff
frequency of 5000 hz and stop band frequency of 10000 Hz. Use Rp=0.1, Rs=60. Determine the
values for the following:

Filter Order = CHEBYCHEV TYPE 1 FILTER


Filter Coefficients:
B = 0.0023 0.0186 0.0652 0.1305 0.1631 0.1305 0.0652 0.0186 0.0023
A = 1.0000 -1.5650 2.-512 -1.4970 0.8488 -0.3101 0.0797 -0.0139 0.0008

Syntax:
Fs = 30000;
Fc = 5000;
Fsb = 10000;
Wp = Fc/(Fs/2);
Ws = Fsb/(Fs/2);
Rp = 0.1;
Rs = 60;
[N,Wn] = buttord(Wp, Ws, Rp, Rs);
[B,A] = butter(N,Wn)

Output:

B=

0.0023 0.0186 0.0652 0.1305 0.1631 0.1305 0.0652 0.0186 0.0023

A=

1.0000 -1.5650 2.0512 -1.4970 0.8488 -0.3101 0.0797 -0.0119 0.0008

2.) Plot the poles and zeroes on the unit circle. Is the plot different from FIR filters? Yes.
Explain.
Because the plot from FIR filters gives the weighted sum of the present and the finite numbers of
previous samples while the pole-zero plot gets the roots of the numerators to the position of
zeroes and roots of the denominator to the position.

Syntaxes and Outputs:


(Syntax continuing from Exercise 1)
zplane(B,A)

freqz(B,A)
Screenshots:
3.) With the same order and cutoff frequency, design a low pass Chebychev type 1 filter and
superimpose its magnitude response to the magnitude response of the butterworth filter. What
do you observer?
In the magnitude plot, when the region with the highest magnitude was zoomed in, we see that
the chebychev type 1 filter has a ripple in the band pass region, while in the butterworth filter has
none.

Syntax:
(Syntax continuing from Exercise 1)
[B1,A1]=cheby1(N,Rp,Wn);
hold on;
freqz(B1,A1)

Output:
Screenshot:

4.) Using a Chebychev Type 2, design a low pass filter with cutoff frequency of 5000 Hz, sampling
frequency of 30000 Hz and an attenuation of greater than or equal 30dB at 7500 Hz. Generate its
frequency response and pole-zero plot.

Syntax:
Fs=30000;
Fc=5000;
Fsb=7500;
Rs=60;
Rp=0.1;
Wp=Fc/(Fs/2);
Ws=Fsb/(Fs/2);
[N,Wn]=cheb2ord(Wp,Ws,Rp,Rs);
[F,E]=cheby2(N,Rs,Wn);
figure(3); zplane(F,E);
figure(4); freqz(F,E);
Output:
Screenshots:
5.) Create a test signal with 2000 sample points. Add five sinusoidal waves with amplitude of 2V and
frequencies of 2 kHz, 3.7 kHz, 6 kHz, 7 kHz and 9 kHz. Using sampling frequency of 20 kHz, plot its
frequency spectrum.

Syntax:
Fs=20000;
t=[0:1999]/(Fs);
y1=2*sin(2*pi*2000*t);
y2=2*sin(2*pi*3700*t);
y3=2*sin(2*pi*6000*t);
y4=2*sin(2*pi*7000*t);
y5=2*sin(2*pi*9000*t);
ytest=randn(1,2000)+y1+y2+y3+y4+y5;
z=fft(ytest,512);
w=(0:255)/256*(Fs/2);
plot(w,abs([z(1:256)]));

Output:
Screenshot:

6.) Design a multiple bandpass filter with sampling frequency of 20000 Hz, pass band frequency of
3000, 6500, and 8500 Hz and stop band frequency of 0, 4800, 7200, 10000 Hz. Determine the
following values:

Roots for Poles


P=
0.0752 + 0.1036i 0.0752 - 0.1036i 0.3074 - 0.6032i
0.3074 + 0.6032i -0.4081 + 0.2079i -0.4081 - 0.2079i

Roots for Zeroes


Z=
0.3470 + 0.0000i -0.0564 - 0.8957i -0.0564 + 0.8957i
0.0608 - 0.0735i 0.0608 + 0.0735i -0.2868 + 0.3467i
-0.2868 - 0.3467i

Multiple Bandpass Filter Coefficients


B = 1.0000 0.0510 0.1525 0.2234 0.0620 -0.0105 0.0016
A = 1.0000 0.2177 0.8023 0.0143 -0.0113 -0.0549 0.0068 -0.0005
Syntax:
Fs=20000;
pole1=3000*(2*pi/Fs);
pole2=6500*(2*pi/Fs);
pole3=8500*(2*pi/Fs);
[x,y]=pol2cart(pole1,0.128); p1=x+y*i;
[x,y]=pol2cart(pole2,-0.677); p2=x+y*i;
[x,y]=pol2cart(pole3,0.458); p3=x+y*i;
P=([p1 conj(p1) p2 conj(p2) p3 conj(p3)])
B=poly(P)
zero1=0;zero2=4800*(2*pi/20000);zero3=7200*(2*pi/20000);zero4=10000*(2*
pi/20000);
[x,y]=pol2cart(zero1,0.3470);z1=x+y*i;
[x,y]=pol2cart(zero2,-0.8975);z2=x+y*i;
[x,y]=pol2cart(zero3,-0.09545);z3=x+y*i;
[x,y]=pol2cart(zero3,0.45);z4=x+y*i;
Z=([z1 z2 conj(z2) z3 conj(z3) z4 conj(z4)])
A=poly(Z)

Output:

P=
0.0752 + 0.1036i 0.0752 - 0.1036i 0.3074 - 0.6032i
0.3074 + 0.6032i -0.4081 + 0.2079i -0.4081 - 0.2079i

B=
1.0000 0.0510 0.1525 0.2234 0.0620 -0.0105 0.0016

Z=
Columns 1 through 6
0.3470 + 0.0000i -0.0564 - 0.8957i -0.0564 + 0.8957i
0.0608 - 0.0735i 0.0608 + 0.0735i -0.2868 + 0.3467i
Column 7
-0.2868 - 0.3467i

A=
1.0000 0.2177 0.8023 0.0143 -0.0113 -0.0549 0.0068 -0.0005

7.) Generate its frequency response and pole-zero plot.


Syntax:
(Syntax continuing from Exercise 6)
freqz(A,B)

Screenshot:
8.) Gilter the test signal using the multiple band pass filter.
Syntax: (Uses the test signal from Exercise 5.)
signalfilter=filter(B,A,ytest);
yfilter=fft(signalfilter,512);
w=(0:255)/256*(Fs/2);
plot(w,abs([yfilter(1:256)]))

9.) Generate the frequency spectrum of the filtered signal. Plot output waveform below. What do
you observe?
The sinusoidal in 6 kHz frequency was significantly increased, while the other part of the signal
frequency has decreased.

Output:
Screenshot:

Google Drive link for Experiment files:


https://drive.google.com/drive/folders/1B8oXsMb2mPlxhSjoombXUeN5i0ujdLcU
?usp=sharing

You might also like