Professional Documents
Culture Documents
ECE107L Experiment4 PDF
ECE107L Experiment4 PDF
SCHOOL OF EE-ECE-CoE
INTRAMUROS, MANILA
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=
A=
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.
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:
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
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: