Lecture 10: That Pesky Modified Nodal and Modified Loop Analysis 1. Hey Professor Ray, can’t we just use supernovas, or supernodes, or something? ANSWER: (Inspired by Bread and Jam for Francis by Russell Hoban) Nodal is what makes SPICE run, But supernodes are no fun, They make equations more complex, With wrong answers that really vex. Avoid that supernodal junk, It really is a bunch of bunk! In modified the equations are easy, And matrix solutions very breezy. Example 1. For the circuit below, write a set of modified nodal analysis equations accounting for initial conditions. THEN set all IC’s to zero and solve for Vout (s) using Crammer’s Rule. Strategy: Add a current label I d flowing from left to right through the floating dependent voltage source. Step 1. Draw frequency domain equivalent circuit. Step 2. Write 2 modified node equations. (a) Node 1: (G1 + C1s)Vin + I d = Iin (s) + C1vC (0− ) 1 (b) Node 2: (G3 + C2s)Vout − I d = C2vC 2 (0− ) Step 3. Write a constraint equation relating Vin (s) and Vout (s) . By inspection (KVL and Ohm’s law in s-­‐‑ world) Vin (s) − Vout (s) = R2 I d + α IC1 Oh no, IC1 is tricky! Yup, be more careful than your professor is careful; you must account for the IC which is part of IC1 . SPECIFICALLY IC1 = C1sVin − CvC1(0− ) Thus ( ) Vin (s) − Vout (s) = R2 I d + α C1sVin − CvC1(0− ) Lettuce ☺ regroup: (α C1s − 1)Vin (s) + Vout (s) + R2 I d = α C1vC1(0− ) Step 4. Put in matrix form. ⎡ C s+G 0 1 ⎢ 1 0 C2s + G3 ⎢ ⎢ 1 ⎢⎣ α C1s − 1 1 ⎤ ⎡ Vin ⎥⎢ −1 ⎥ ⎢ Vout ⎥⎢ R2 ⎥ ⎢ I d ⎦⎣ ⎤ ⎡ I in + C1vC1(0− ) ⎥ ⎢ ⎥ = ⎢ C2vC 2 (0− ) ⎥ ⎢ − ⎥⎦ ⎢ α C1vC1(0 ) ⎢⎣ Step 5. Now suppose all initial conditions are zero, α = 0.5 , and all other parameter values are 1. ⎤ ⎥ ⎥ ⎥ ⎥ ⎥⎦ Compute the transfer function and the step response assuming vout (t) is the output. Recall, transfer function and step response calculations require all IC’s to be zero, vs. not to be. ⎡ ⎡ s +1 0 1 ⎤ ⎢ Vin ⎢ ⎥ 0 s + 1 −1 ⎢ ⎥ ⎢ Vout 1 ⎥⎢ I ⎢ 0.5s − 1 1 ⎣ ⎦ ⎢⎣ d ⎤ ⎡ I ⎥ ⎢ in ⎥=⎢ 0 ⎥ ⎢ 0 ⎥⎦ ⎢⎣ ⎤ ⎥ ⎥ ⎥ ⎥⎦ Step 5a. ⎡ s +1 I in ⎢ det ⎢ 0 0 ⎢ 0.5s − 1 0 ⎢⎣ Vout (s) = ⎡ s +1 0 ⎢ det ⎢ 0 s +1 ⎢ 0.5s − 1 1 ⎣ 1 ⎤ ⎥ −1 ⎥ 1 ⎥ ⎥⎦ 2−s = I in 1 ⎤ (s + 1)(s + 6) ⎥ −1 ⎥ 1 ⎥ ⎦ Step 5b. H (s) = Vout (s) 2−s = I in (s + 1)(s + 6) Step 5c. Step response calculation. 1 3 4 1 2−s Vout,step (s) = H (s) = = 3 − 5 + 15 s s(s + 1)(s + 6) s s + 1 s + 6 in which case ⎡1 ⎤ 4 vout,step (t) = ⎢ − 0.6e−t + e−6t ⎥ u(t) 15 ⎣3 ⎦ SOLUTION IN MATLAB Part 1: Solution using Crammer’s Rule: >> syms M1 M2 Vout Iin vout voutstep s t >> M1 = [s+1 Iin 1;0 0 -­‐‑1;0.5*s-­‐‑1 0 1] M1 = [ s + 1, Iin, 1] [ 0, 0, -­‐‑1] [ s/2 -­‐‑ 1, 0, 1] >> M2 = [s+1 0 1;0 s+1 -­‐‑1;0.5*s-­‐‑1 1 1] M2 = [ s + 1, 0, 1] [ 0, s + 1, -­‐‑1] [ s/2 -­‐‑ 1, 1, 1] >> Vout = det(M1)/det(M2) Vout = -­‐‑(Iin*(s -­‐‑ 2))/(2*(s^2/2 + (7*s)/2 + 3)) >> Vout = collect(Vout) Vout = ((-­‐‑Iin)*s + 2*Iin)/(s^2 + 7*s + 6) Remark: the above equation relates Vout to I in indicating that the associated transfer function is H (s) = Vout 2−s 2−s = 2 = I in s + 7s + 6 (s + 1)(s + 6) >> % Compute Step Response >> Iin = 1/s; >> M1 = [s+1 Iin 1;0 0 -­‐‑1;0.5*s-­‐‑1 0 1] M1 = [ s + 1, 1/s, 1] [ 0, 0, -­‐‑1] [ s/2 -­‐‑ 1, 0, 1] >> Vout = det(M1)/det(M2) Vout = -­‐‑(s -­‐‑ 2)/(2*s*(s^2/2 + (7*s)/2 + 3)) >> voutstep = ilaplace(Vout) voutstep = (4*exp(-­‐‑6*t))/15 -­‐‑ (3*exp(-­‐‑t))/5 + 1/3 Remark: Clearly vout,step (t) = 4 −6t 3 1 e u(t) − e−t u(t) + u(t) 15 5 3 Example 2. Write and solve modified loop equations for the circuit below assuming vC (0− ) = 0 and iL (0− ) = 1. The s-­‐‑domain equivalent circuit is given to save time and space. Note that the addition of a voltage label across the dependent current source common to two loops. Step 2. Write two loop equations. Clearly ☺, Loop 1: Vin (s) = ⌢ s+2 1 I1(s) − I 2 (s) + V (s) s +1 s +1 ⌢ 1 s2 + s + 1 Loop 2: 1 = − I (s) + I (s) − V (s) s +1 1 s +1 2 Step 3. Write the constraint equation for the dependent current source. 3VR = I 2 − I1 ⇒ 4I1 − I 2 = 0 Step 4. Put in matrix form ⎡ s+2 ⎢ ⎢ s +1 ⎢ −1 ⎢ ⎢ s +1 ⎢ 4 ⎢ ⎢⎣ ⎤ 1 ⎥ ⎥⎡ ⎥⎢ s2 + s + 1 −1 ⎥ ⎢ s +1 ⎥⎢ −1 0 ⎥ ⎢⎣ ⎥ ⎥⎦ −1 s +1 I1 ⎤ ⎡ Vin ⎥ ⎢ I2 ⎥ = ⎢ 0 ⌢ ⎥ ⎢ 0 V ⎥ ⎢ ⎦ ⎣ ⎤ ⎥ ⎥ ⎥ ⎥⎦ Step 5. Solve equations using the symbolic toolbox in MATLAB. >> M1 = [(s+2)/(s+1) -­‐‑1/(s+1) 1;-­‐‑1/(s+1) (s^2+s+1)/(s+1) -­‐‑1;... 4 -­‐‑1 0] M1 = [ (s + 2)/(s + 1), -­‐‑1/(s + 1), 1] [ -­‐‑1/(s + 1), (s^2 + s + 1)/(s + 1), -­‐‑1] [ 4, -­‐‑1, 0] >> syms Solvecs Solvect b Vin >> b = [Vin; 0 ; 0] b = Vin 0 0 >> Solvecs = inv(M1)*b Solvecs = Vin/(4*s + 1) (4*Vin)/(4*s + 1) (Vin*(4*s^2 + 4*s + 3))/((4*s + 1)*(s + 1)) >> % Compute Step reponses >> Vin = 1/s; >> b = [Vin; 0 ; 0] b = 1/s 0 0 >> Solvecs = inv(M1)*b Solvecs = 1/(s*(4*s + 1)) 4/(s*(4*s + 1)) (4*s^2 + 4*s + 3)/(s*(4*s + 1)*(s + 1)) >> Solvect = ilaplace(Solvecs) Solvect = 1 -­‐‑ exp(-­‐‑t/4) 4 -­‐‑ 4*exp(-­‐‑t/4) exp(-­‐‑t) -­‐‑ 3*exp(-­‐‑t/4) + 3