





















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






















Number of Sessions – 4
being implementing those filters, as well as some others on the PC and a DSP system. The first part involves the design of some fourth order and higher filters using MATLAB and a the design of some filters on the PC using MATLAB and QEDesign, and the second, f MATLAB commands useful for filter design. Further details may be found in the MATLAB manual, Appendix B includes instructions for using the Momentum Data Syst design system.ilter design program called QEDesign. To help you towards this end, Appendix A provides a list ofems QEDesign digital filter methods of implementation will be evaluated. In order to gain some familiarity with digital filter design, you are require^ The second part involves the implementation and analysis of these filters on the PC. Twod to solve the following problem prior to the first lab session: Convert the analog low-pass filter:
should have a cut sampling period (T) of 7 msec. Your answer should be in the-off frequency of 143 rad/sec. Use the impulse invariant tran^ H^ ( s )^ =^1 +^1 sRC to an equivalent digital low Z domain, and should include an-pass filter. The filtersformation with a associated block diagram. The program on the PC is set up to implement two different fourth order filters:
and^ H^ (^ z )^ =^ A^1 +^ +^ DzBz ""^11 ++^ CzEz ""^22 +^ F^1^ ++^ GzIz ""^11 +^ +^ JzHz "^2 "^2
Block diagrams of the two filter forms are shown in Figure 1 and Figure 2. To run the program,^ H^ ( z^ )^ =^1 A +^ +^ DzBz ""^11 ++^ EzCz ""^22 #^ F^1^ ++^ GzIz ""^11 +^ +^ JzHz "^2 "^2 go to the program is entirely menu driven. One of the two implement menu. Subsequently, the filter coefficients C:\CSTUDIO\CAL_LAB\FILTER A throughdirectory and type J may be entered. Pressing theation forms may be chosen from the main digfilte at the DOS prompt. The 〈END〉 key
FIGURE 1. Filter Type I.
y(k)
maximally flat), the Chebyshev (two version^ There are three main types of low The Butterworth low-pass filter of order-pass filter approximations. They are the Butterworth (or s), and the elliptic approximations. n has an amplitude ratio given by
unity at^ This filter, whose Bode plot is shown in Figure 4, has a gain which decreases monotonically from f = 0 Hz. As n (the filter order) is increased, the rate of fall off of the filter at its cutoff^ H^ (^ f )^ =^ (^ )^ *^1 +^ "^ #^ $^^ Bf %^ &^ '^2 n^ +^ ,^ -^.^12 frequency is increased. This is not without a penalty, because as the filter degree increases, the phase shift gets worse, and the impulse response does not follow the The Chebyshev filter (Type I) has a ripple in the pass-band, and decreases monotonically in the sinc pulse very closely. stop 5. This filter has the advantage of band, the magnitude of the frequency response fluctuates between 1 and 1/(1 + the ripple is larger but the fall off is faster. There is a design trade-band. The Type II filter reverses these bands. A typical frequency response is shown in Figure a faster rate of fall off, and a more linear phase shift. In the pass-off between e 2 the ripple size and)1/2. For a larger e-, the fall off for a given filter order. the fastest fall off rate of the three filter types but has a large phase shift. This filter ag The elliptic filter allows ripples in both the pass and stop-bands, as shown in Figure 6. This hasain has a trade off between ripple size and fall [3]. -off rate. For further details on analog filter types see reference BAND using the low A band - PASS FILTER DESIGN - pass filter with center pass-pass to band-pass transformation.-band frequency w 0 can be derived from a low-pass filter by 7a. To make a band up to j poles and zeros in complex conjugate pairs.^ A polew 0. This would-zero pattern and frequency response curve for a typical low-pass filter you might try to make the substitution not work because any circuit built with real elements must have all complex- pass filter is shown in Figure s → s - jw 0 to move the poles pass filter H(s) by^ A substitution that does work is the replacement of the Laplace domain variable^ s^ in the low- ! where s (^ s^ b^ "^ j^ #^02 ) s^ ( bs^ b^ +^ j^ #^0 ) operation close to the center frequency filter becomesb^ is the Laplace variable of the transformed band w 0 (i.e. sb is approx equal to-pass filter. Then, for frequencies of jw 0 ), the transformed low-pass ! where D is the deviation from^ H^ ( s^ )^ = wH 0^^ $^ %^ &. (^ s Thus, the shape and bandwidth of the low b^ "^ j^ #^02 ) s^ ( bs^ b^ +^ j^ #^0 )^ '^ (^ )^ *^ H^ (^2 j + sb )^2 sb^ *^ H^ (^ j +) -pass filter are preserved. This transformation leads to complex conjugate poles and zeros as shown in Figure 7b, and is therefore realizable.
FIGURE 3a. Ideal Low-Pass.
FIGURE 3b. Impulse Response of a Low-Pass filter.
FIGURE 3c. Delayed Response of a filter.
FIGURE 5. Chebyshev Low-Pass Filter.
FIGURE 6. Elliptic Low-Pass Filter.
FIGURE 7a. Low-Pass Filter.
1 1 + " 2
DISCRETE TIME SYSTEMS^ FIGURE 7b. Transformed Band-Pass Filter. every (i.e ., a series of values occurring every variables are discrete signals.^ A discrete signal is an ordered sequence of numbers. If you sampled a continuous signal x T seconds, your output would be a function ( T seconds). A discrete system is one in which all the x ( kT ) : k = 0, 1, 2, .. .), which is a discrete signa l(t) time is known if you know the system's present state and the input.^ A discrete system i A state variable equation can be written ass analogous to a continuous system in many ways. The output of the system at any future y ( kT ) = S [ q 0 : x ( kT )] k ≥ k 0 , where x ( kT ) is the input, q principles systems described by differential equations. The block diagram elements of a discrete system are unit delay 0 is the initial state at a (^) reof describeddecomposability, k by = k difference 0 , and superposition, y ( kT equations) is the output. A fixed, linear discrete system will obey the and in timethe sameinvariance way that(see continuousreference [2]).systems Discrete are elements and scalars.
All systems involving digital computers for signal processing are discrete time systems. To work^ FIGURE 8. Simul^ a. Time-Delay Element.ation Diagram Elements.^ b. Scalar. on a signal, it must first be coded into some binary representation. This analog to digital conversion takes some finite signal is to be processed in real time, the amount of time taken to perform calculations and output results must be addedamount of time. Therefore, there is some maximum sampling frequency. If the to this conversion time. This reduces the maximum possible sampling frequency. To simplify the manipulation of continuous systems, the Laplace transform is used. An analogous tool for the discrete system is the infinite summation Z-transform. The Z-transform of v(k) is defined as the
by replacing^ The other technique used for the experiment is the bilinear transformation. This is accomplished s by ( z^ FIGURE 9. Step Response of a Butterworth Low – 1)/( z +1) in the transform of the analog filter HA ( s ). Rearra - Pass Filter. nging the new transfer function guaranteed to have the same general shape as those corresponding to frequency scales. For example, consider the respo frequency gives ω 0. The transfer function is given by the desired HD ( z ). The magnitudense of the filter to a sinusoidal input of radian and the phase plots H (^) A of( s (^) ), but with distorted HD ( z ) obtained are
!
HD ( z ) (^) z = e j " 0 T = H (^) A^ $ % &^ z z^ #+^11 ' ( ) z = e j " 0 T ! Hence,^ j^ "^ A^ =^ z^ z^ #+^11 z =^ e^ j^ "^0 T^ =^ e^ e^ jj^ "^ "^00 TT^ #+^11 =^ j^ tan^ $^ %^ &^ "^02 T '^ (^ ) ! This warping is illustrated for a band-pass filter in Figure 10.^ "^ A^ =^ tan^ #^ $^ %^ "^02 T &^ '^ ( the frequency distortion. The advantage of the bilinear transformation is related to fold problems. Fold the sampling frequency. Then, because the frequency response repeats every^ This transformation is used mostly where you have stop and pass-over is the situation which occurs if the frequency response is not band-bands and can compensate for f S, the characteristic-limited to half-over or alias has an overlap, i.e., an aliasing problem. The bilinear transformation maps the entire strip bounded by over problem since there are no frequency components past s = +jπ f s and s = - jπ f s; then mapping this into the s = jπ f s (^). z - plane results in no aliasing fold s - plane into a-
function^ The impulse invariant Butterworth tran H ( j ω)^2 = 1/(1 + B ( ω)2n), where n is the order of the filter. To get a cutsfer function is derived from the magnitude squared-off frequency at ω 0 , it is
necessary that then B = (143)- 8 H. To get( j ω 0 )^2 = 1/2 at H(s ), set ω 0. Thus, 1 + B ( ω 0 )2n^ = 2. For example, if ω 0 = 143 rad/sec, and n = 4, ! and replace plane poles are associated with ω^2 by - s^2. All the left H( - half plane poles are then associated with - s). Doing this for the above fourth order fil^ H^ ( s^ )^ H^ ("^ s )^ =^ H^ (^ j^ #)^ #^2 2 $" s^^2 H(s) ter gives and all the right-half
! This is then expanded into partial fractions in order to get the impulse invariant^ H^ ( s^ )^ =^ (^^ s^ "^143 #112.5°)^ ( s^^ "^143 #247.5(^143 °)^ ( s^ )^4^ "^143 #157.5°)(^ s^^ "^143 #202.5°) Z-transform. A useful formula can be used to facilitate the transformation from a second order pair of complex conjugate s - plane poles to the z - plane. If for example,
!
H (^) ( s ) = (^) s " ax #^ + 180 jy ° " $ + (^) s " ax #^ " 180 jy ° + $ ! then,^ H^ ( s^ )^ =^^ s^ "^ ax #^ +^180 jy °^ "^ $^ +^^ s^ "^ ax #^ "^180 jy °^ +^ $ !
H (^) ( z ) = Z{ H ( s )} = (^1) " z " x 1^ e + b^ # jy 180 °" $ + (^1) " z " x 1^ e " b^ # jy 180 °+ $
where^ FIGURE 10. Warping of the Frequency axis caused by the Biline b = aT or ar Transformation.
The analog elliptic filter for the warped specifications is given by !
Applying the bilinear transformation to H 1 (s)^ H^1 gives^ (^ s )^ =^^ s^2 As +^ Cs^ +^^ B +^ D
! Thus, for the above transfer function,^ H^1 (^ z )^ =^1 +^ A^ C^ +^1^^ ++ B^ Dz "^^1 +^ #^ $^ %^1 z "^2 +^1 D^ C^ #^ $^ %^1^ "++^2 D^2 CB^ +&^ '^ (^ + D^ z &^ '^ ("^2 +^ #^ $^ %^ z^11 ""+^2 #^ $^ % CC^1^ +++ B^ CDD^ "^^ +&^ '^ ( A^ D &^ '^ ( !
H (^) ( z ) = .078985 1 + z +" 1 z (^) (" "^1 1.2300^ (.183462^ ) +) z^ +" 2 z (^) (".61146 2 (.104477^ ) )+ ".028022 1 +^ + z^ " z 1 " (^) (^1 "^ (1.0730^ ".032195) + ) z^ +"^2 z (^) (".95469 2 ("^ .0047312) ) D. BAND transformation followed by the bilinear transformation. When the bilinear transform is applied to an The band - PASS FILTER - pass filter is derived from a low-pass filter by using the low-pass to band-pass analog appropriately using filter to produce a digital filter, the bandwidth and center frequency must be warped ! If the desired c the sampling frequency is 143 Hz, then the center frequency of the analog filter must beenter frequency of a band-pass filter with bandwidth 14.3 rad/sec is 286 rad/sec and^ "analog^ =^ tan^ "^02 T
! Bandwidth conversion is done as follows:^ "analog^ =^ tan^ (^286 /sec)^2 (^ .007^ sec)=^ tan^ (^1 )^ =^ 1.5574^ rad/sec
!
" # filter =^ " # filter^1^ =^ d^ #^ dfilter^ #^ (^ "^ #)^ =^ cos^21 (^ #^2 T )^ ( T^2 )^ ("^ #) The second order Butterworth low-pass filter for these warped specifications is^ cos^2 (^1 )^ (.007^ sec^ /^2 )^ (14.3^ rad/sec)^ =^ .171^ rad/sec ! where a is the bandwidth. Applying the band^ H^ (^ s )^ =^^ s^2 "^2 -^2 as pass transformation, a^2^ +^2 a^2 =^^ s^2 "^ .346.0599 s^ +^. !
s " s^2 2 + s^ #^02
yields ! Applying the unscaled bilinear transformation, we get^ H^ ( s^ )^ =^^ ss^ +(.01907^ s^ (.2254^ )^ )"^ +^ .32548^ 2.0719^ +^^ s^2 s^^ (+^ "^ s .01907^ (.2638^ ))^ +^ +^ .4459^ 2. !
H (^) ( z ) = (^ ".092927 1 + z )"^ + (^1) ( z .65018 "^1 ("^ .19742) + z ") 2 + (^) (.86326 z "^2 ("^ .10449) )+ (.10404^1 + z )^ "+ (^1) ( z .89635 "^1 (.21739^ ) + z )"^ + (^2) ( z .87136 "^2 (.11334) )
calculations. MATLAB and SPW are available on RCS and QEDesign is Windows PCs. Some functions to aid you in designing the filters in MATLAB are listed in Appendix A and Appendix B of this handout has is a brief manual on the QEDesign package along with^ For this section, you will be required to use MATLAB or QEDesign, to help with filter design on the CAL Microsoft instructions for using the DSP system. The MATL QEDesign filters may be run on either the PC directly or the DSP (digital signal processor) board linked to the PC. PC implementations are restricted to 4 while the DSP can handle higher than 20th (^) order filters with a minimumAB designs can only be run on the PC whileth (^) order filters with a minimum T = 20.833 microseconds T = 1.1 msec but limits them to cascade form (Type II). with a For each of the following questions, be sure to include the filter coefficients in your report along z - plane analysis. Do not include any MATLAB diary files, m-files, etc. Computer generated frequency response plots, however, are needed since they can be compared to your lab results. 1) Pick a sampling frequency for a filter to be designed. For PC filter designs, use a sampling per must use aiod range of T corresponding to one of the standard sample frequencies listed in the table on T = .0011 to T = .007 sec. The ADSP 21020 (Analog Devices' DSP board) filters page 10 of Appendix B. (The actual period corresponding to the sample fre entered into the PC program should however be confirmed in the lab. This can be done by running a simple all measuring the sample period.)-pass filter with A = F = 1 and all other coefficients set to 0 andquency value
H (^) ( s ) = (^) ( s + .13674 +( .11624^ j .33993)^ ()^ s (^ s "^ +3.07658 .13674) "^ (^ s^ j +.33993^ .00966) (^ s +^ + j .014965.57887)^ (^ + s^ + j^ .53943.00966)^ " ( s^ j +.57887 .014965) " j .53943) !
filters. Note that these functions are described in the MATLAB manual, a copy of which is available on-line. The HELP command in MATLAB should also provide sufficient detail. ANGLE, UNWRAP angle ( h ) returns the phase angle in radians, of the elements of the complex the transitions phase matrix. angles across These in branch vec anglestor cuts. by will addingThe liephase multiplesbetween must be +ofπ in and+2 radians.π – orπ. - unwrap(p) 2 π, to smooth corrects the BILINEAR [ zd,pd,kd ]= bilinear ( z,p,k,fs ) converts the s-domain transfer function specified are factor. in columncolumn f (^) s byvectors (^) isvectors zeros,the (^) z sample (^) d (^) ,polescontaining pd (^) and (^) frequencyand scalar gainthe in k intozeros d. Hz. a andThediscrete poles,discrete equival and equivalent kent. is Inputsa scalaris returnedz andgain p discrete^ [ numd,den equivalent. d ]= bilinear The( num,den,f function s ) isconverts^ an^ s-domain^ transfer^ function^ to^ a
BUTTAP [ z,p,k ]= buttap ( n ) returns the zeros, poles and gain of an order n normalized returned matrix, asin (^) there Butterworthlength are nno column zeros.analog vector (^) Thelow transfer- pass p , thefilter function gain prototype.in is k, and The z is polesan emptyare
with vectors^ [ b,a cutoff]= bbutter and frequency a (. n,wn )^ designswn and returnsan^ order the^ n^ filterlow-pass coefficients^ digital^ Butterworth in length n+1 filter row
and frequency the stop to- bandbe used extends with cheby2 from w s (^) isto also1, the returned. Nyquist frequency. wn , the natural CHEBY1 CHEBY2 [ b,a ]= cheby1 ( n,r p ,wn ) designs an order n low-pass digital Chebyshev filter with vectors cutoff a and frequency b contain w n the and filter r p dB coefficients.of ripple in the pass n - n band. n+1 long row
frequency two^ [ [ b,ab,a element]=]= cheby1 (^) cheby1wn .vector.(( n,rn,r pp ,w,wcheby2nn,'high','stop' accepts))^ designsdesigns the ansame^ aorder^ parametershigh 2 n - passstop^ - asbandfilte cheby1 filterr^ ,with but if^ designs w cutoff n is a a ELLIP type II Chebyshev filter. with dB returned [down b,a cutoff]= from ellip in frequency n+1 (the n,r long p ,r peaks ,ww row nn ,)value^ designs r vectorsp dB in of theanripple a^ andorderpass b in^ - .band. n^ Ifthelow w - pass n passThe = - [^ band,filter w digital 1 w 2 ] and (^) iscoefficients^ elliptic aa stoptwo -^ elementbandfilter are r s vector, frequency [ [ b,ab,a (^) ]=]=a (^) ellip (^) ellip band wn. -((pass n,rn,r pp ,r,r filterss ,w,wnn,'high','stop' of order)) (^) designsdesigns 2 n is andesigned aorder high 2 - with n pass stop w (^1) - (^) filterband<