![]() |
![]() |
|
|
| <<Home | Lab 7 (Butterworth and Chebyshev Filters) | |||
|
Butterworth Filter
Example 1 Find the transfer function of a first order Butterworth filter wn = 1 radian per second. Solution [num,den] = butter(1,1,'s'); % butter(order,cut-off frequency,'s plane') printsys(num,den) % The magnitude response of the filter can now be computed as follows: [y,w] = freqs(num,den); % generates frequency response vector y and a frequency vector w y1 = abs(y); % magnitude response of the filter plot(w,y1) Result
Magnitude response of different order
Exercise 1a Using the built in function "hold-on" or otherwise, compute the magnitude response of first order (as compared above), second order, third order and fourth order low pass Butterworth filter with cut-off frequency of 1 radian per second. All plots must appear on the same paper. Print your Roll No. on top of the graph paper. Solution [num,den]=butter(1,1,'s'); printsys(num,den) [y,w]=freqs(num,den); y1=abs(y); % 2nd order [num2,den2]=butter(2,1, 's');printsys(num2,den2) [y2,w2]=freqs(num2,den2); y2=abs(y2); % 3rd order [num3,den3]=butter(3,1, 's');printsys(num3,den3) [y3,w3]=freqs(num3,den3); y3=abs(y3); % 4th order [num4,den4]=butter(4,1, 's');printsys(num4,den4) [y4,w4]=freqs(num4,den4); y4=abs(y4); plot(w,y1, 'b',w2,y2,'c',w3,y3,'g',w4,y4,'m')Result
Poles and Zeros
Exercise 1b Find Poles and Zeros of all of the above filters and plot them (separate graph for each filter) onto the s-plane. Solution [num,den]=butter(1,1, 's');printsys(num,den) [y,w]=freqs(num,den); y1=abs(y); nump=[1]; denp=[1 1]; poles=roots(nump); zeros=roots(denp); pzmap(nump,denp) grid % figure [num2,den2]=butter(2,1, 's');printsys(num2,den2) [y2,w2]=freqs(num2,den2); y2=abs(y2); nump=[1]; denp=[1 1.4142 1]; poles=roots(nump); zeros=roots(denp); pzmap(nump,denp) grid % figure; [num3,den3]=butter(3,1, 's');printsys(num3,den3) [y3,w3]=freqs(num3,den3); y3=abs(y3); nump=[1]; denp=[1 2 2 1]; poles=roots(nump); zeros=roots(denp); pzmap(nump,denp) grid % figure; [num4,den4]=butter(4,1, 's');printsys(num4,den4) [y4,w4]=freqs(num4,den4); y4=abs(y4); nump=[1]; denp=[1 2.6131 3.4142 2.6131 1]; poles=roots(nump); zeros=roots(denp); pzmap(nump,denp) grid Result
Magnitude response of a normalized 1st, 2nd, 3rd, high pass Butterworth filter
Exercise 1c Use on-line help to plot the magnitude response of a normalized first-order, second-order, third-order high-pass Butterworth filter. Solution
Result
Band stop Butterworth filter
Exercise 1d Repeat 1(c) for a band-stop Butterworth filter. Choose a range of frequencies (to be stopped) on your own choice. Solution Result
Chebyshev Filter
Example 2 The transfer function of a low-pass type 1 Chebyshev filter of order 1 with cut off frequency 1 radian/sec and a ripple of 0.5 dB in passband can be determined as follows: Solution [num,den]=cheby1(1,0.5,1, 's');disp( 'The Transfer Function of the filter is')printsys(num,den) [y,w]=freqs(num,den); y1=abs(y); plot(w,y1) Result
Chebyshev Filter
Exercise 2a Sketch the magnitude and phase response of a first-order, second-order, third-order and fourth-order type 1 lowpass Chebyshev filter with passband edge frequency of 10 radian/sec and passband ripple of 5 dB. Investigate the effect of changing order on the magnitude response of the system. Solution [num,den]=cheby1(1,5,10, 's');disp( 'The Transfer Function of the filter is')printsys(num,den) [y,w1]=freqs(num,den); y1=abs(y); pha1=angle(y); % [num,den]=cheby1(2,5,10, 's');disp( 'The Transfer Function of the filter is')printsys(num,den) [y,w2]=freqs(num,den); y2=abs(y); pha2=angle(y); % [num,den]=cheby1(3,5,10, 's');disp( 'The Transfer Function of the filter is')printsys(num,den) [y,w3]=freqs(num,den); y3=abs(y); pha3=angle(y); % [num,den]=cheby1(4,5,10, 's');disp( 'The Transfer Function of the filter is')printsys(num,den) [y,w4]=freqs(num,den); y4=abs(y); pha4=angle(y); % plot(w1,y1, 'b',w2,y2,'g',w3,y3,'y',w4,y4,'m')figure; plot(w1,pha1, 'b',w2,pha2,'g',w3,pha3,'y',w4,pha4,'m')Result
Chebyshev Filter
Exercise 2b Draw the magnitude response of a third order lowpass type1 Chebyshev filter when the passband ripple is 0.5 db, 1 db, 2 db, 3.5 db and 5 db. What is the effect of the changing passband ripple on the magnitude response. Solution [num,den]=cheby1(3,0.5,10, 's'); % let passband edge frequency is 10 rad/secdisp( 'The Transfer Function of the filter is')printsys(num,den) [y,w1]=freqs(num,den); y1=abs(y); % [num,den]=cheby1(3,1,10,'s'); disp('The Transfer Function of the filter is') printsys(num,den) [y,w2]=freqs(num,den); y2=abs(y); % [num,den]=cheby1(3,2,10,'s'); disp('The Transfer Function of the filter is') printsys(num,den) [y,w3]=freqs(num,den); y3=abs(y); % [num,den]=cheby1(3,3.5,10,'s'); disp('The Transfer Function of the filter is') printsys(num,den) [y,w4]=freqs(num,den); y4=abs(y); % [num,den]=cheby1(3,5,10,'s'); disp('The Transfer Function of the filter is') printsys(num,den) [y,w5]=freqs(num,den); y5=abs(y); plot(w2,y1,'b',w2,y2,'g',w3,y3,'y',w4,y4,'m',w5,y5,'c') Result
As we are increasing passband ripple, ripple is increasing in the figure. Chebyshev Filter
Exercise 2c Sketch magnitude response of a third order band-stop type1 low-pass filter which stops frequencies from 5 radian per second to 15 radian per second and allow all other frequencies to pass. Solution [num,den]=cheby1(3,2,[5 15], 'stop','s');disp( 'The Transfer Function of the filter is')printsys(num,den) [y,w]=freqs(num,den); y1=abs(y); plot(w,y1) Result
Chebyshev Filter
Exercise 2d Plot magnitude response of a fourth order high pass type1 Chebshev filter with passband ripple of 0.5 db, 2 db, 3db and 5db which rejects all frequencies below 10 radians per second. Solution [num,den]=cheby1(4,0.5,10, 'high','s');disp( 'The Transfer Function of the filter is')printsys(num,den) [y,w1]=freqs(num,den); y1=abs(y); % [num,den]=cheby1(4,2,10, 'high','s');disp( 'The Transfer Function of the filter is')printsys(num,den) [y,w2]=freqs(num,den); y2=abs(y); % [num,den]=cheby1(4,3,10, 'high','s');disp( 'The Transfer Function of the filter is')printsys(num,den) [y,w3]=freqs(num,den); y3=abs(y); % [num,den]=cheby1(4,5,10, 'high','s');disp( 'The Transfer Function of the filter is')printsys(num,den) [y,w4]=freqs(num,den); y4=abs(y); plot(w1,y1, 'b',w2,y2,'g',w3,y3,'y',w4,y4,'m')Result
Chebyshev Filter type 2
Exercise 3a Draw magnitude response of a first-order, second-order, third-order and fourth-order low-pass band edge frequency of 10 radians/sec and pass-band ripple of 20 dB. Solution [num,den]=cheby2(1,20,10, 's');disp( 'The Transfer Function of the filter is')printsys(num,den) [y,w1]=freqs(num,den); y1=abs(y); % 2nd order [num,den]=cheby2(2,20,10, 's');disp( 'The Transfer Function of the filter is')printsys(num,den) [y,w2]=freqs(num,den); y2=abs(y); % 3rd order [num,den]=cheby2(3,20,10, 's');disp( 'The Transfer Function of the filter is')printsys(num,den) [y,w3]=freqs(num,den); y3=abs(y); % 4th order [num,den]=cheby2(4,20,10, 's');disp( 'The Transfer Function of the filter is')printsys(num,den) [y,w4]=freqs(num,den); y4=abs(y); plot(w1,y1, 'b',w2,y2,'g',w3,y3,'y',w4,y4,'m')Result
Chebyshev Filter type 2
Exercise 3b Draw a high pass type 2 Chebyshev filter which rejects all frequencies below 10 radians per second. Take a ripple = 20 dB. Solution [num,den]=cheby2(1,20,10, 'high','s');disp( 'The Transfer Function of the filter is')printsys(num,den) [y,w]=freqs(num,den); y1=abs(y); plot(w,y1) Result
Chebyshev Filter type 2
Exercise 3b Sketch magnitude response of a third order type 2 band stop filter with passband ripple of 20dB which stops frequencies from 10 to 20 radians per second and allows all other frequencies to pass. Solution [num,den]=cheby2(3,20,[10 20], 'stop','s');disp( 'The Transfer Function of the filter is')printsys(num,den) [y,w]=freqs(num,den); y1=abs(y); plot(w,y1) Result
HELP BUTTER
BUTTER Butterworth digital and analog filter
design. FREQS
FREQS Laplace-transform (s-domain) frequency
response. CHEBY1
CHEBY1 Chebyshev type I digital and
analog filter design. CHEBY2
CHEBY2 Chebyshev type II digital and
analog filter design. HOLD
DSP Lab 1 DSP Lab2 DSP Lab 3 DSP Lab4 DSP Lab 5 DSP Lab 6 DSP Lab7 DSP Lab8 DSP Lab9 DSP Lab10 Other material |
||||
| <<Home | ||||
|
||||||