Why Bode? The great popularity of Bode magnitude plots stems from the following useful properties of logarithms: ( s + a ) n ( s + b) m If H ( s ) = then ( s + c) l ( s + d ) k log10 [H ( s )] = n log10 ( s + a) + m log10 ( s + b) − l log10 ( s + c) − k log10 ( s + d ) Thus the magnitude functions are asymptotic to straight lines on a log-log plot. dB or not dB? That is the question Bode Plots are Magnitude and Phase versus frequency graphs. There are two log-log conventions for plotting magnitude versus frequency: log magnitude and decibels (dB). Decibels (dB) to Magnitude Conversion Magnitude dB = 20log10(Magnitude) Magnitude Conversion to Decibels (dB) Magnitude = 10(Magnitude dB)/20 Here is a conversion table: Decibel Examples Magnitude 1,000,000,000 100,000,000 10,000,000 1,000,000 100,000 10,000 1,000 100 10 4 2 1 1/2 1/4 0.1 0.01 0.001 0.0001 0.00001 0.000001 0.0000001 0.00000001 0.000000001 dB +180 +160 +140 +120 +100 +80 +60 +40 +20 +12 +6 0 -6 -12 -20 -40 -60 -80 -100 -120 -140 -160 -180 Bode Plot Slopes for Poles and Zeros at the Origin Bode Plot with Magnitude on a dB Scale in MATLAB % Magnitude of a Transfer Function on a dB Plot % Save output figures in bitmap mode for best quality s = tf('s'); H = 0.010*(s + 20)/((s + 1)*(s + 7000)); [mag phase w] = bode(H); %Magnitude in dB not on log scale mag2 = 20*log10(mag); figure; semilogx(w, reshape(mag2, 1, length(mag2)), 'LineWidth', 2); grid minor; %finer grid xlabel('\omega (rad/s)'); ylabel('Magnitude in dB'); figure; semilogx(w, reshape(phase, 1, length(phase)), 'LineWidth', 2); grid minor; %finer grid xlabel('\omega (rad/s)'); ylabel('Phase (degrees)'); ______________________________________________________________________ Bode Plot with Magnitude on Log Scale in MATLAB %Log Magnitude Plot % Save output figures in bitmap mode for best quality s = tf('s'); H = (s + 50)/((s + 10)*(s + 60000)); [mag phase w] = bode(H); figure; loglog(w, reshape(mag, 1, length(mag)), 'LineWidth', 2); grid on; xlabel('\omega (rad/s)'); ylabel('Magnitude'); figure; semilogx(w, reshape(phase, 1, length(phase)), 'LineWidth', 2); grid on; xlabel('\omega (rad/s)'); ylabel('Phase (degrees)'); Stability from Bode Plots L(jω) Closed Loop System is stable provided the Gain of L(jω) is less than 1 AND the phase of L(jω) is less than 180o for all ω Let ωπ be the phase cross over frequency where the phase of the open loop transfer function crosses 180o Let ωg be the gain cross over frequency where the open loop gain crosses 1. Gain Margin = 1/|L(jωπ )| and Phase Margin = arg L(jωg)+π System is marginally stable when Gain Margin = 0 dB AND Phase Margin = 0o (i.e., ωg = ωπ ) Gain & Phase Margin Defined |L(jω)| 1 arg L(jω) -180o 1 = |L(jωπ )| Gain Margin O ωg ωπ O ωg ωπ ω ω Phase Margin=arg L(jωg)+π FINDING CLOSED LOOP STABILITY MARGINS FROM THE OPEN LOOP GAIN Problem: For the Open Loop Magnitude and Phase Plots shown below, find 1) Gain Crossover Frequency, ωg 2) the Phase Crossover Frequency, ωπ 3) Gain Margin (linear and dB), and 4) the Phase margin (in degrees and radians) |L(jω)| Gain Margin : 1 1 = ≈ 4.5 = 13 dB K= L( jω g ) 0.22 L(jω) K - ωg ωπ arg[L(jω)] FINDING THE CLOSED LOOP PHASE MARGIN Phase Margin = + 47° = + 0.82 rad ωg EXAMPLE: FINDING K FOR A GIVEN PHASE MARGIN REQUIREMENT Problem: Find the value of K such that the open loop system with the frequency response shown has a closed loop PM of +20° (and thus the closed loop system is stable). (When PM=0°, K is Gain Margin) |L(jω)| K= - K L(jω) 1 1 = = 2.22 L( jωd ) 0.45 arg[L(jω)] EXAMPLE: FINDING K FOR A GIVEN PHASE MARGIN REQUIREMENT PM = + 20° ωd = 0.7rad / sec . CHAPTER 6 FREQUENCY RESPONSE |KL(jω)| MAGNITUDE PLOT FOR K=2.22 ωd = 0.7rad / sec . CHAPTER 6 FREQUENCY RESPONSE arg[KL(jω)] PHASE PLOT FOR K=2.22 PM = + 20° What is the open loop transfer function KL(jω) for the system whose magnitude and phase plots are shown on the previous few slides? Inspection of magnitude and phase plot indicates that KL(jω) is of the form: KL( jω ) = K1 jω ⎛⎜1 + jω ⎞⎟ ωo ⎠ ⎝ 2 where |KL(jω)|ω=0.10 =10 ≈ |K1/(jω)|ω=0.10 = K1/ω ω=0.10 = 10K1 => K1 =1 φ(ω=ωo) = φ[1/(jωo)] + φ{1/[1+j(ωo/ωo)]2} = -90o-90o= -180o =>ωo = 1 Hence the transfer function is: KL( jω ) = 1 2 jω (1 + jω ) MATLAB CODE: >> sys =tf([1 0],[1 5 6]) Transfer function: s ------------s^2 + 5 s + 6 >> sys.outputd=0.2 Transfer function: s exp(-0.2*s) * ------------s^2 + 5 s + 6 >> margin(sys) Derive the Magnitude and Phase of the following functions of ω and plot both the Magnitude and Phase functions on the ω axis using the same logarithmic scale for 0< ω <∞. These are often referred to as Bode plots. a) jω c) 1+jω b) (jω)2 c) (jω)3 d) (1+jω)2 g) (1+j3ω)/(1+j2ω) d) 1/jω e) 1/(1+jω) h) (1+j2ω)/(1+j3ω) j) jω/[(1+j2ω)(1+j3ω)] l) exp(j2ω) n) exp(-j4ω)jω/[(1+j2ω)(1+j3ω)] e)1/(jω)2 d)1/(jω)3 f) 1/(1+jω)2 i) jω/(1+jω) m) exp(-j3ω) o) X(jω) = 2sin(ωT)/ ω X(jω) = 2sin(ωT)/ω Magnitude φ(ω) = Phase π 2sin(ωT)/ω ω 0 −π /T π /T