ME 48/58 Chapter 3 HW February 6, Chapter 3 HW Solution Problem. Here you re given a lead network often used in control systems to improve the transient response which adds around 6 of phase angle at about ω = 3 rad/s. he lead network transfer function is H(s) = s.s (a) he phase angle of the continuous system at 3 rad/sec is φ = 54.87. You can get the H(z) and phase angles using MALAB cd and bode (except for the rectangular integration rules) or you can get the H(z) manually and evaluate its angle with z = e jω with =.5 (z =.73 j.68). My results were (i) Forward rectangular (F): () (ii) Backward rectangular (B): s = z = H F (z) = (z.75) z.5 UNSABLE!! () (iii) rapezoidal (): s = z z = H B (z) = 3.574(z.8) z.857 = φ B = 38.9 (QUIE LOW) (3) s = z z = 8z z = H 5(z.7777) (z) = z. (iv) trapezoidal (P): here we have A = ω / tan (ω /) = 7.64... = φ = 54.9 (VERY CLOSE!) (4) s = A z z = 7.64z z = H 4.896(z.768) P (z) = z.35 (v) Pole-Zero mapping (PZ): = φ P = 54.87 (EXAC!!) (5) Map poles and zeros using z = e s = H P Z (z) = 4.496(z.7788) z.8 = φ P Z = 47.57 (LOW) (6) 8 6 4 Backward rapezoidal Pole Zero 5 rapezoidal Parabolic 8 5 6 4 5 Frequency (rad/sec) Frequency (rad/sec) (a) and discrete versions. (b), trapezoidal, and parabolic. Figure : Bode plots of the various lead networks. Referring to Figure (a), the two best methods appear to be rapezoidal and, with Pole-Zero Mapping not too bad. It is no coincidence that MALAB cd supports these three methods, but not Forward
ME 48/58 Chapter 3 HW February 6, or Backward rectangular. Forward in particular is dangerous, since it can result in an unstable discrete transfer function (it did in this problem). (b) Bode amplitude plots of the original continuous system and all the simulations (except F) are also shown in Figure. Note the degeneration of all discrete systems at higher frequencies. (c) Here I speculated on a parabolic rule based on our Chapter HW problem on parabolic integration. Following the derivation of the trapezoidal rule in Section 3..3, we get a parabolic substitution rule as: s z(z ) 5z 8z As expected, this rule is somewhat more complex than the other integration-based substitution rules. Also, I would not attempt solving (7) for z = f(s). Use of the parabolic rule of (7) in our lead network produces the discrete system (7) H P ara (z) = 5.48(z.7789)(z.4) (z.955)(z.5) = φ P ara = 55.67 (CLOSE) (8) For all the work involved in the parabolic rule, it s not quite as accurate (at least at ω = 3) as the trapezoidal (unless I made a mistake quite likely!) As another check, I compared the Bode magnitude plots of the continuous, trapezoidal, and parabolic in Figure (b). It appears that the parabolic rule sticks with the continuous a little longer than the trapezoidal rule, but...considering the additional hassle, the parabolic rule is probably not worth it! Problem. he transfer function of a second-order system with ζ =., ω n = 5 rad/s ( 8 Hz), and unity DC gain is: ω n G C (s) = s ζω n s ωn = 5 s s 5 (9) (a) We can do the rapezoidal and discrete simulations using MALAB, since it supports these, but the MALAB Matched (similar to Pole-Zero mapping) is not quite the same as I present in my notes, so we have to do that one manually. Using =. ( Hz sampling), my results are: (i) rapezoidal (): G (z) =.538z.75z.538 z.69z.88 (ii) (P) at frequency ω n : G P (z) =.559z.7z.559 z.66z.85 (iii) Pole-Zero mapping (PZ): G P Z (z) =.555z.z.555 z.5968z.887 =.538(z z ) z.69z.88 =.559(z z ) z.66z.85 =.555(z z ) z.5968z.887 (poles z =.865 ± j.44) () (poles z =.88 ± j.486) () (poles z =.7984 ± j.457) () he three simulations are quite similar, with only minor deviations in numerator gain and pole locations. he zero locations of all three are exactly the same! (b) he Bode amplitude plots of the continuous and all three discrete simulations from. to Hz are shown in Figure (a). hey all work pretty well (relatively fast sampling), but again the discrete systems go crazy at higher frequencies. he resonant peak of the continuous system is G C peak = = 3.5355 =.97 db (3) ζ All three discrete simulations show a resonant peak which is virtually identical to the continuous system. (c) Unit step responses of the continuous and prewarped are shown in Figure (b). Pretty good agreement.
ME 48/58 Chapter 3 HW February 6, Phase angle (deg) 4 6 8 rapezoidal Pole Zero 45 9 35 8 5 7 (a) Bode plots. System output.6.4..8.6.4....3.4.5 ime (seconds) (b) Step responses. Figure : Bode plots and step responses of Problem. Problem 3. A notch filter is used to remove a given frequency from a signal. Since power-line noise is a common component, consider a notch filter that removes 6 Hz from the input. he transfer function of a second-order notch filter at frequency ω o is where the damping ratio is ζ = / =.77. H C (s) = Y (s) U(s) = s ω o s ζω o s ω o (a) Frequency f o = 6 Hz corresponds to ω o = πf o = 376.99 rad/s. he notch filter at this frequency is simply equation (4) evaluated at this ω o and the given ζ. his H C (s) should be entered into MALAB. (b) Sampling frequency f s = 5 Hz corresponds to =. seconds, or msec. he prewarped substitution is s = A z z, A = ω ( ) o tan ωo = 95.79 = for comparison (5) When this substitution is used (or use MALAB cd using prewarp ), the resulting H P (z) is given by H P (z) =.6738z.984z.6738 z.984z.3477 It is interesting to examine the zero and pole locations of H P (z), which are =.6738(z.4579 ) z.984z.3477 Zeros: z =.79 ± j.6845, Poles: z =.49 ± j.36 (7) he zeros are right on the unit circle, corresponding to the the jω axis in the s-plane. his is the notch! he angle of these zeros is θ =.754 rad, and so (4) (6) θ =.754 = ω = ω = θ = 376.99 (8) which corresponds exactly to 6 Hz. (c) Bode magnitude plots of both H C (s) and H P (z) over f Hz are shown in Figure 3(a). he prewarped H P (z) displays almost exactly the same notch as the original continuous system, with inaccuracy at higher frequencies. It would perform very well at filtering out the 6 Hz frequency component. (d) o test the notch filter, create an input consisting of Hz sinusoid plus a 6 hz sinusoid, both of unity magnitude. I assumed that three periods of the Hz sinusoid would be long enough to reach steady-state, and that s about.3 seconds. hus I created a time vector of.3 seconds in length with a time step of (.). he complete MALAB code is shown below (including the discretization of the notch filter): 3
ME 48/58 Chapter 3 HW February 6, 5 5.5 Input Output 5 3 35 4 45 5 3 (a) Bode plots showing 6 Hz notch. Input, Output.5.5.5.5..5..5.3 ime (seconds) (b) Passing Hz, filtering out 6 Hz. Figure 3: Behavior of notch filter. >> fo = 6; % Notch frequency in Hz >> wo = *pi*fo; % Convert notch frequency to rad/sec >> zeta = sqrt()/; % Damping ratio >> numc = [ wo^]; % numerator s^wo^ >> denc = [ *zeta*wo wo^]; % denominator s^*zeta*wn*swn^ >> Hc = tf(numc,denc); % Form continuous LI notch filter >> =.; % Define sampling period >> Hd = cd(hc,, prewarp,wo); % Get prewarped simulation of notch filter >> tmax =.3; % Maximum time of simulation >> t = ::tmax; % ime vector from -> tmax at spacing >> f = ; % of first input component >> f = 6; % of second input component >> u = sin(*pi*f*t)sin(*pi*f*t); % Construct the input (frequencies in rad/s) >> y = lsim(hd,u,t); % Get the output using the MALAB lsim function >> plot(t,u, r-,t,y, k- ); % Plot input (red) and output (black) >> xlabel( ime (seconds) ); % Label X axis >> ylabel( Input, Output ); % Label Y axis (e) It so happens that the notch filter transfer function H P (z) is in exactly the same form as the example in the notes in equation (3.33). So the block diagram for optimal realization of the notch filter will be exactly like Figure 3.7, and the pseudo-code to generate this filter is exactly that on page 48. I ll reproduce both of those here for the sake of completeness. he notch filter transfer function is H P (z) =.6738z.984z.6738 z.984z.3477 and the (observer canonical) block diagram is (next page): =.6738.984z.6738z.984z.3477z = b b z b z a z a z (9) 4
ME 48/58 Chapter 3 HW February 6, u k b b b x z x z y k a a Figure 4: Observer canonical block diagram of notch filter. read difference equation parameters and initialize variables; set FLAG = ; 3 select sample period, start clock; 4 if (FLAG == ) print ("sampling period too short") and exit; 5 while (FLAG == ) wait; 6 u = adc_in(); 7 y = x b*u; 8 dac_out(y); 9 x = x b*u a*y; x = b*u a*y; 3 goto 4; he code above from line 6 to line 3 contains the following operations: A/D conversion varies depending on resolution, but around µsec. D/A conversion also dependent on resolution, but much faster, say µsec. 5 floating point multiplies on my ancient Apple.5 GHz G4 PowerBook FMUL = 9 nsec. 4 floating point additions on the G4 PowerBook FADD = 9 nsec. 3 floating point assignments same computer, FASSIGN = 8 nsec. Miscellaneous other operations (integer float & float integer conversion, etc.) So I could compute this notch filter algorithm much faster than 5 Hz (the IBM G4 PowerPC processor has pretty fast floating-point operations). Most of the time is spent in A/D conversion. here are very fast A/D converters they just cost more. Also, DSP chips are built for fast floating point multiplies and adds. hese days, many industrial and consumer communication and control devices (cell phones, military communications, etc.) have embedded DSP chips. It s a different world than in 979 when I first developed this course. But some things never change... 5