Objective: Finding Transfer Functions of Circuits Using State-Space Write the state-space model for a circuit Find the transfer function for a system in state-space form Discussion Assume either The input to a circuit, x(t), was zero for t<, or The input to a circuit, x(t), is periodic and has been on for a long time. If the first case, you can use LaPlace transforms with zero initial condition. In this case dx dt sx x()=sx d 2 x dt 2 s 2 X dx() dt sx()=s 2 X In short, you can simply replace all derivatives with 's' terms. In the latter case, you can use phasor notation substituting jω for derivatives, or 's' for derivatives assuming s = jω. In either case, you ignore the initial conditions and replace derivatives with 's'. Example 1: Consider trying to find the transfer function for the following circuit: 1a) Find the transfer function from X to 1b) Find the response to x(t) =2sin(3t) 1c) Find the frequency response from X to 1d) Find the impulse response from X to X V1 V2 V3 X + - C C C C + - ou have four capacitors, meaning you will have four coupled differential equations. Given time, you could solve to find the transfer funciton. State-space is much faster, however. JSG 1 rev April 15, 29
1a) Find the transfer function. Step 1: eplace C with 1 Cs CsV 1 = X V 1 + V 1 Cs = V 1 + V 3 CsV 3 = V 3 + V 3 Cs V 3 and sum the current to zero. Note: Group terms and solve for the highest derivative: sv 1 = 2 C V 1 + 1 C + 1 C X s = 1 C V 1 + 2 C + 1 C V 3 sv 3 = 1 C + 2 C V 3 + 1 C s 1 C V 3 + 1 C I = C dv dt = CsV Place in matrix form s V 1 V 3 2 C 1 C = 1 C 2 C 1 C 1 C 2 C 1 C 1 C 1 C V 1 V 3 + 1 C X = 1 V 1 V 3 Example: Let = 1k, C = 1uF, s V 1 V 3 = +[]X 1 C = 1 2 1 1 2 1 1 2 1 1 1 V 1 V 3 + 1 X JSG 2 rev April 15, 29
In SciLab: so >A = [-2,1,,;1,-2,1,;,1,-2,1;,,1,-1] A = - 2. 1... 1. - 2. 1... 1. - 2. 1... 1. - 1. >B = [1;;;]; >C = [,,,1]; >D = ; >S1 = syslin('c',a,b,c,d); >h = ss2tf(s1) h = 2 1-5.457D-12s - 4.547D-13s ------------------------------ 2 3 4 1 +1s + 15s + 7s + s 1 s 4 +7s 3 +15s 2 +1s+1 X Note that this was much easier than solving four equations for four unkowns. In MATLAB >A = [-2,1,,;1,-2,1,;,1,-2,1;,,1,-1] A = - 2. 1... 1. - 2. 1... 1. - 2. 1... 1. - 1. >B = [1;;;]; >C = [,,,1]; >D = ; >[num,den] = ss2tf(a,b,c,d) num 1 den 1 7 15 1 1 meeaning 1 s 4 +7s 3 +15s 2 +1s+1 X JSG 3 rev April 15, 29
1b) Find the response to x(t) = 2sin(3t) Let s j3 1 s 4 +7s 3 +15s 2 +1s+1 X s=j3 In SciLab or MATLAB: >s = j*3; >G1 = 1./ (s.^4 + 7*s.^3 + 15*s.^2 + 1*s + 1); > abs(g1).3531 > 18/%pi*atan(imag(G1),real(G1)) in SciLab > 18/pi*angle(G1) in MATLAB -96.9 = (.3531 96.9 )X The output is.3531 times the input, shifted by -96.9 degrees y(t)=.763 sin (3t 96.9 ) 1c) Find the frequency response. Plug in s jω In SciLab: >j = sqrt(-1); >w = [-1:.1:2]'; >w = 1.^w; >s = j*w; >G1 = 1./ (s.^4 + 7*s.^3 + 15*s.^2 + 1*s + 1); >plot(w,abs(g1)) >xlabel('rad/sec'); >ylabel('gain') JSG 4 rev April 15, 29
Note: The gain at 3 rad/sec (part b) is just one point on this plot. The frequency response tells you a lot more. For example, if the input were less than 1 rad/sec, the ouput would be about the same as the input (the gain is one). If the input is higher than 1 rad/sec, the ouput is small, less than.1 times the input. This is a low-pass filter. 1d) Find the impulse response: 1 s 4 +7s 3 +15s 2 +1s+1 X X= 1 (x is an impulse, the LaPlace transform of an impulse is '1'. Factor -->roots([1,7,15,1,1]) - 1.261476-1. - 23.472964-35.32889 A = B = C = 1 (s+1.26)(s+1)(s+23.47)(s+35.32) A s+1.26 + B s+1 + 1 (s+1)(s+23.47)(s+35.32) 1 (s+1.26)(s+23.47)(s+35.32) 1 (s+1.26)(s+1)(s+35.32) C s+23.47 + D s+35.32 = 1.4972 s= 1.26 = 3.3341 s= 1 = 2.8139 s= 23.47 so D = 1 (s+1.26)(s+1)(s+23.47) =.977 s= 35.32 1.4972 s+1.26 + 3.3341 s+1 + 2.8139 s+23.47 +.977 s+35.32 y(t)=(1.4972e 1.26t 3.3341e 1t + 2.8139e 23.47t.977e 35.32t )u(t) JSG 5 rev April 15, 29
Example 2: 2a) Find the transfer function from X to 2b) Find the response to x(t) =2sin(3t) 2c) Find the frequency response from X to 2d) Find the impulse response from X to Ls Ls Ls V2 V4 V6 + X - I1 I3 I5 1/Cs 1/Cs 1/Cs + - There are six energy storage elements (L,C). This means you'll be solving for an 6th-order differential equation. That's a pain by hand. State-space in MATLAB or SciLab isn't too bad, though. 2a) Find the transfer function. Convert to LaPlace (already shown above.) L Ls and C 1 Cs Write the differential equations. ou should have six coupled differential equations since there are six energy storage elements: LsI 1 = X Cs = I 1 I 3 LsI 3 = V 4 CsV 4 = I 3 I 5 LsI 5 = V 4 V 6 CsV 6 = I 5 V 6 Group and place in matrix form: JSG 6 rev April 15, 29
I 1 V 1 C 2 I s 3 V 4 = I 5 V 6 = 1 Assume L=.1, C=.1, = 1: s I 1 I 3 V 4 I 5 V 6 = 1 L 1 C 1 L 1 L 1 C 1 C 1 L 1 L 1 C 1 I 1 I 3 V 4 I 5 V 6 +[]X 1 1 1 1 1 1 1 1 1 1.1 I 1 I 3 V 4 I 5 V 6 I 1 I 3 V 4 I 5 V 6 + + In SciLab: >A = [,-1,,,,;1,,-1,,,;,1,,-1,,;,,1,,-1,;,,,1,,-1;,,,,1,-.1] >B = [1;;;;;]; >C = [,,,,,1]; >D = ; >S2 = syslin('c',a,b,c,d); >h = ss2tf(s2) 2 3 4 5 1 + 1.D-11s - 7.276D-11s + 4.45D-13s - 3.411D-13s + 1.291D-15s ----------------------------------------------------------------------- 2 3 4 5 6 1 + 3s + 6s + 4s + 5s +.1s + s 1 X 1 L X So 1 s 6 +.1s 5 +5s 4 +4s 3 +6s 2 +3s+1 X JSG 7 rev April 15, 29
2b) Find the response for x(t) = 2sin(3t) Plug in s = j3 >s = j*3; and find the gain: >G = 1./ (s.^6 +.1*s.^5 + 5*s.^4 + 4*s.^3 + 6*s.^2 + 3*s + 1); >abs(g) 4.14 >18/%pi*atan(imag(G),real(G)) >18/pi*angle(G) -.9 = (2.7.9 )X The output is 2.7 times the input, shifted by -.9 degrees: y(t)=4.14 sin(3t.9 ) in SciLab in MATLAB 2c) Find the frequency response: Plug in s jω >w = [-1:.1:2]'; >w = 1.^ w; >s = j*w; >G = 1./ (s.^6 +.1*s.^5 + 5*s.^4 + 4*s.^3 + 6*s.^2 + 3*s + 1); >plot(w,abs(g)) >xlabel('rad/sec'); >ylabel('gain'); Note: The gain at 3 rad/sec (part b) is just one point on this plot. The frequency response tells you a lot more. For example, if the input were 4, 12, or 18 rad/sec, you'd have a much larger output. These are called 'resonances' for the circuit: frequencies where the gain shoots up. (The exact frequencies of these resonances are hard to see JSG 8 rev April 15, 29
on this graph. The resonance is very close to the imaginary parts of the poles. From part b) below, the resonances are actually at {4.45, 12.47, 18.2 rad/sec} 1d) Find the impulse response. Convert to LaPlace ( δ(t) 1) and factor: --> = roots([1,.1,5,4,6,3,1]) = So -.271571 + 4.453712i -.271571-4.453712i -.174644 + 12.46971i -.174644-12.46971i -.53785 + 18.19339i -.53785-18.19339i 1 (s+.2715±j4.453)(s+.1746±j12.4697)(s+.537±j18.19) note: There really are six terms in the denominator. Each complex pole has a corresponding complex conjugate. The notation above uses ' ' as shorthand notation to say there are two poles: one at +j and a second at -j. ± Using partial fractions (only showing the +j terms: there will also be the conjugates) A s+.2715+j4.453 A = 2.7157 89.92 B = 1.7464 9.2 C =.53787 89.7 + B s+.1746+j12.4697 + C s+.537+j18.19 ou can solve this in SciLab or on your calculator. In SciLab, for example, use A = ((s +.271 + j4.453) G(s)) s.271 j4.453 : +complex conjugates Take a point close to this pole (not exactly on it since this will cause a divide by zero error): ->s = (2) +.1 -.27157-4.453712i Evaluate G(s) -->G = 1./ (s.^6 +.1*s.^5 + 5*s.^4 + 4*s.^3 + 6*s.^2 + 3*s + 1); Multiply by (s +.271+j4.453) >A = G * (s - (2)) >abs(a) 2.7157342 So >18/%pi*atan(imag(A),real(A)) 89.927152 JSG 9 rev April 15, 29
2.7157 89.92 s+.2715+j4.453 Take the inverse LaPlace transform: + 1.7464 9.2 s+.1746+j12.4697 +.53787 89.7 s+.537+j18.19 y(t)= (5.43e.2715t cos (4.453t 89.92 ) +3.4929e.1746t cos (12.4697t + 9.2 ) +1.757e.537t cos (18.19t 89.7 ))u(t) +complex conjugates ecall from earlier lectures, the constant out front is twice the amplitude of each term (A, B, C). The angle for each term is minus the angle of A, B, and C. JSG 1 rev April 15, 29