![]() |
![]() |
|
|
| <<Home | Lab 10 (Design of IIR Filters) | |||
|
MATLAB has a number of built-in functions for IIR filter design, Some of these include following. butter % Analog Butterwoth filter buttord % order of butterworth filter cheby1 % Type 1 Chebyshev filter impinvar % Impulse inversion method bilinear % Bilinear Transformation Conversion of analogue filter into digital filter Example 1 It is required to design a digital filter to a design a digital filter to approximate the following normalized analog transfer function: H(s) = 1/(s2+1.414s+1) Use the impulse invariant method to obtain the transfer function, H(z), of the digital filter, assuming a 3dB cut-off frequency of 150Hz and a sampling frequency of 1.28kHz. Solution n=2; fs=1280; fc=150; wc=2*pi*fc; [num,den]=butter(n,wc, 's');[numd,dend]=impinvar(num,den,fs); [h,f]=freqz(numd,dend,512,fs); h1=abs(h); mag=20*log10(h1); plot(f,mag); grid; ylabel( 'Magnitude response(dB)');xlabel( 'Frequency(Hz)');Result
Transfer function using bilinear transformation
Example 2 A requirement exists to simulate in a digital computer an analogue system with the following normalized characteristics: H(s) = 1/(s2 + 1.414s + 1) Obtain a transfer function using the bilinear transformation. Assume a sampling frequency of 1.28 kHz and a 3 dB cut-off frequency of 150Hz. Plot pole-zero diagram, impulse response and step response. Solution clear fs=1280; wp=2*pi*150; fn=fs/2; t=1/fs; wpp=tan(wp*t/2); [num,den]=butter(2,1,'s'); %analog printsys(num,den); [num1,den1]=lp2lp(num,den,wpp); % denormailizedprintsys(num1,den1); [numd,dend]=bilinear(num1,den1,fn/fs); % digital reponseprintsys(numd,dend, 'z');[h,f]=freqz(numd,dend,512,fs); mag=abs(h); plot(f,mag); grid; ylabel( 'Magnitude response(dB)');xlabel( 'Frequency(Hz)');figure poles=roots(numd) zeros=roots(dend) zplane(numd,dend); figure; dimpulse(numd,dend); figure; dstep(numd,dend); Result Normalized analog Butterworth filter 1 num/den = ------------------ s^2 + 1.4142 s + 1
Low pass to low pass transformation
0.1488
Bilinear transformation
0.087821 z^2 + 0.17564 z + 0.087821
poles =
Second order high pass digital filter
Exercise 2 Design a second order high pass digital filter with cut off frequency of 30Hz and a sampling frequency of 150Hz. Sketch magnitude response, phase response, impulse response, step response and pole-zero diagram of the filter. Hint: replace the command lp2lp lp2hp in example 2. Solution clear fs=150; wp=2*pi*30; % fc=30Hz cut off frequency fn=fs/2; t=1/fs; wpp=tan(wp*t/2); [num,den]=butter(2,1,'s'); %analog printsys(num,den); [num1,den1]=lp2hp(num,den,wpp); % denormailizedprintsys(num1,den1); [numd,dend]=bilinear(num1,den1,fn/fs); % digital reponseprintsys(numd,dend, 'z');[h,f]=freqz(numd,dend,512,fs); mag=20*log10(abs(h)); plot(f,mag); grid; ylabel( 'Magnitude response(dB)');xlabel( 'Frequency(Hz)');figure poles=roots(numd) zeros=roots(dend) zplane(numd,dend); figure; dimpulse(numd,dend); figure; dstep(numd,dend); Result
A discrete time bandpass filter with Butterworth characteristic
Example 3 A discrete time band-pass filter with Butterworth characteristics meeting the following specifications is required: band-pass 200 - 300 Hz Sampling frequency 2 kHz Filter order 2 Solution fs=2000; wp1=2*pi*200; wp2=2*pi*300; fn=fs/2; t=1/fs; wpp1=tan(wp1*t/2); wpp2=tan(wp2*t/2); w=(wpp1+wpp2)/2; bw=wpp2-wpp1; [num,den]=butter(1,1,'s'); printsys(num,den) [num1,den1]=lp2bp(num,den,w,bw); printsys(num1,den1) [numd,dend]=bilinear(num1,den1,fn/fs); printsys(numd,dend,'z') [h,f]=freqz(numd,dend,512,fs); mag=abs(h); plot(f,mag), grid poles=roots(numd); zeros=roots(dend); figure; zplane(numd,dend); figure; dimpulse(numd,dend); figure; dstep(numd,dend); Result
A discrete time band-stop filter with Butterworth characteristic
Exercise 3 A discrete time band-stop filter with Butterworth characteristics meeting the following specifications is required. Obtain the coefficients of the filter using the BLT method. stop-band 200 - 300 Hz Sampling frequency 2 kHz Filter order 2 Solution fs=2000; wp1=2*pi*200; wp2=2*pi*300; fn=fs/2; t=1/fs; wpp1=tan(wp1*t/2); wpp2=tan(wp2*t/2); w=(wpp1+wpp2)/2; bw=wpp2-wpp1; [num,den]=butter(1,1,'s'); printsys(num,den) [num1,den1]=lp2bs(num,den,w,bw); printsys(num1,den1) [numd,dend]=bilinear(num1,den1,fn/fs); printsys(numd,dend,'z') [h,f]=freqz(numd,dend,512,fs); mag=abs(h); plot(f,mag), grid poles=roots(numd); zeros=roots(dend); figure; zplane(numd,dend); figure; dimpulse(numd,dend); figure; dstep(numd,dend); Result Normalized analog Butterworth filter
1 Low pass to band- stop transformation
s^2 + 0.17407
Bilinear transformation
0.86413 z^2 - 1.2158 z + 0.86413
HELP PLOT
PLOT Linear plot. C2DM
C2DM Conversion of continuous LTI systems to
discrete-time. IMPINVAR
IMPINVAR Impulse invariance method for analog
to digital filter conversion.
DSP Lab 1 DSP Lab2 DSP Lab 3 DSP Lab4 DSP Lab 5 DSP Lab 6 DSP Lab7 DSP Lab8 DSP Lab9 DSP Lab10 DSP Lab 11 Other material |
||||
| <<Home | ||||
|
||||||