Ece107l - E04 - 01 - Exp4
Ece107l - E04 - 01 - Exp4
Grade
1. Using Butterworth filter, design a low pass filter with a sampling rate of 30000 Hz and a cutoff
frequency of 5000 Hz and stop band frequency of 10000 Hz. Use Rp=0.1, Rs=60. Determine the
values of the following:
Filter Order = CHEBYSHEV TYPE 1 FILTER
Filter Coefficients:
B = Columns 1 through 5
Columns 6 through 9
A = Columns 1 through 5
Columns 6 through 9
Syntax:
>> fs=30000;
>> fc=5000;
>> fsb=10000;
>> Rp=0.1;
>> Rs=60;
>> Wp=fc/(fs/2)
>> [N, Wn] = buttord(Wp, Ws, Rp, Rs)
>> [B, A] = butter (N, Wn)
2. Plot the poles and zeroes on the unit circle. Is the plot different from FIR filters?
Explain.
Yes. Because pole-zero plots gets the roots of the numerators to the position of zeros
and roots of the denominator to the position while FIR gives the weighted sum of the present
and finite numbers from the previous samples.
Syntax:
>> zplane(B,A,'m-.<')
>> freqz (B,A)
3. With the same order and cutoff frequency, design a low pass Chebyshev type 1 filter and super
impose its magnitude response to the magnitude response of the butterworth filter. What do
you observe?
The chebyshev type 1 has a ripple in the band pass region.
Zoom In:
Syntax:
>> [B2, A2] = cheby1(N, Rp, Wn);
>> hold on;
>> freqz (B, A)
>> hold on;
>> freqz (B2, A2)
4. Using a Chebyshev 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:
>> Fs1=30000;
>> Fc1=5000;
>> Fsb1=7500;
>> Rs1=60;
>> Rp1=0.1;
>> Wp1=Fc1/(Fs1/2);
>> Ws1=Fsb1/(Fs1/2);
>> [N1, Wn1] = cheb2ord(Wp1,Ws1,Rp1,Rs1);
>> [C, D]=cheby2(N1,Rs1,Wn1);
>> zplane(C,D,'m-,<')
>> freqz(C,D)
5. Create a test signal with 2000 sample points. Add five sinusoidal waves with amplitude of 2V
and frequencies of 2kHz, 3.7kHz, 6kHz, 7kHz, and 9kHz. Using sampling frequency of 20 kHz, plot
its frequency spectrum.
Syntax:
>> Fs2=20000;
>> t=[0:1999]/(Fs2);
>> 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=rand(1,2000)+y1+y2+y3+y4+y5;
>> z=fft(ytest,512);
>> w=(0:255)/256*(Fs2/2);
>> plot(w,abs([z(1:256)]),'m-.<')
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, and 10000 Hz. Determine
the following values:
Columns 1 through 2
Columns 3 through 4
Columns 5 through 6
Columns 1 through 2
Columns 3 through 4
Columns 5 through 6
Columns 7 through 8
Columns 6 through 7
-0.0105 0.0016
A=
Columns 1 through 5
Columns 6 through 9
Syntax:
>> Fs3=20000;
>> pole1=3000*(2*pi/Fs3);
>> pole2=6500*(2*pi/Fs3);
>> pole3=8500*(2*pi/Fs3);
>> [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(pole1,0.3470);
>> z1=x+y*i;
>> [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.45);
>> [x,y]=pol2cart(zero3,-0.09545);
>> z3=x+y*i;
>> [x,y]=pol2cart(zero4,0.45);
>> z4=x+y*i;
>> Z=([z1 conj(z1) z2 conj(z2) z3 conj(z3) z4 conj(z4)])
>> A3=poly(Z)
Syntax:
>> zplane(A3,B,'m-.<')
>> freqz(A3,B)
8. Filter the test signal using the multiple band pass filter.
Syntax:
>> signalfilter=filter(B,A3,ytest);
>> yfilter=fft(signalfilter,512);
>> w1=(0:255)/256*(Fs3/2);
>> plot(w1,abs([yfilter(1:256)]),'m-.<')
9. Generate the frequency spectrum of the filtered signal. Plot output waveform below. What do
you observe?
At 6kHz, the waveform was at its maximum.
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner