EECS 105 SPRING 2004, Lecture 1 Lecture 2: Frequency domain analysis, Phasors Prof. J. Stephen Smith Department of EECS University of California, Berkeley EECS 105 Fall 2004, Lecture 2 Prof. J. Stephen Smith Announcements z z z z z z z The course web site is http://inst.eecs.berkeley.edu/~ee105 Today’s discussion section will meet The Wednesday discussion section will move to Tuesday, 5:00-6:00, 293 Cory You can go to any or all discussions you like. Labs will start Feb 3. Reading assignments from the text will start next week There is a homework set due Wed. 1/28 Department of EECS University of California, Berkeley 1 EECS 105 Fall 2004, Lecture 2 Prof. J. Stephen Smith Context In the last lecture we covered: z how circuits can be modeled as linear circuits by design or approximation. z How to convert a linear circuit into a set of differential equations. In this lecture, we will cover: z How to use complex analysis to solve circuits by converting the differential equations in the time domain into algebraic equations in the frequency domain. Department of EECS University of California, Berkeley Linear Circuit model↔ set of linear differential equations EECS 105 Fall 2004, Lecture 2 Prof. J. Stephen Smith resistors vr (t ) = ir (t ) ⋅ r inductors vL (t ) = L capacitors ic (t ) = C diL (t ) dt dvC (t ) dt The wires convey the variables (voltages and currents) between the equations (components) , by applying Kirchoff’s laws. For the low pass example: vout (t ) = vc (t ) vin = vr + vc iin = ir = ic + iout Department of EECS University of California, Berkeley 2 EECS 105 Fall 2004, Lecture 2 Prof. J. Stephen Smith Differential equation for low pass: We are going to take the output current equal to zero, for simplicity, so: vr = ir R = ic R = RC dvC (t ) dt vout (t ) = vc (t ) vin = vr + vout = vout + RC dvout (t ) dt Department of EECS University of California, Berkeley EECS 105 Fall 2004, Lecture 2 Prof. J. Stephen Smith →Equation For any linear circuit, you will be able to write: L1{vout (t )} = L 2 {vin (t )} = d d2 avin (t ) + b1 vin (t ) + b2 2 vin (t ) + L dt dt + c1 ∫ vin (t ) + c2 ∫∫ vin (t ) + c3 ∫∫∫ vin (t ) + L L {}, L {} 1 2 Here represent Linear operators, that is, if you apply it to a function, you get a new function (it maps functions to functions), and linear operators also have the property that: L{a ⋅ f (t ) + b ⋅ g (t )} = a ⋅ L{ f (t )} + b ⋅ L{g (t )} Department of EECS University of California, Berkeley 3 It’s now just mathematics, and therefore easy! EECS 105 Fall 2004, Lecture 2 Prof. J. Stephen Smith Once we establish a linear model for a circuit, by design or approximation: z We can directly use the powerful methods of linear analysis from mathematics. z We can develop our intuition as to what will happen, allowing us to design. Department of EECS University of California, Berkeley EECS 105 Fall 2004, Lecture 2 Prof. J. Stephen Smith Fourier Transform One important linear analysis technique we will use is the Fourier Transform: The Fourier transform states: F (ω ) = +∞ ∫ f (t )e − jωt dt −∞ f (t ) = 1 2π +∞ ∫ F (ω )e jωt dω −∞ Notice that what this says is that information that is expressed as a function of time (voltage or current for example) can be completely expressed as a function of frequency: F (ω ) Department of EECS University of California, Berkeley 4 EECS 105 Fall 2004, Lecture 2 Prof. J. Stephen Smith Linearity Let’s use functions of frequency F (ω ) (voltages and currents) rather than functions of time as our new variables. The Fourier relationship shows us that if we can find these functions of frequency, we can then convert them into the voltages and currents as a function of time that we want. We can do this in every equation for our linear components. 1 f (t ) = 2π +∞ ∫ F (ω )e j ωt dω −∞ We just substitute this form into each of our equations Department of EECS University of California, Berkeley EECS 105 Fall 2004, Lecture 2 Prof. J. Stephen Smith Resistors: vr (t ) = ir (t ) ⋅ r 1 2π Department of EECS +∞ 1 v ( ω ) e d ω = r ∫ 2π −∞ jωt +∞ ∫ i (ω ) ⋅ re r jωt dω −∞ University of California, Berkeley 5 EECS 105 Fall 2004, Lecture 2 Prof. J. Stephen Smith Capacitors: ic (t ) = C 1 2π 1 2π dvC (t ) dt +∞ d 1 i ( ω ) e d ω = C c ∫ dt 2π −∞ +∞ jωt 1 ∫−∞ic (ω )e dω = 2π jωt +∞ ∫ v (ω )e j ωt c dω −∞ +∞ ∫ C ( jω )v (ω )e c j ωt dω −∞ Department of EECS University of California, Berkeley EECS 105 Fall 2004, Lecture 2 Prof. J. Stephen Smith Inductors: vL (t ) = L 1 2π 1 2π Department of EECS +∞ diL (t ) dt d 1 v ( ω ) e d ω = L L ∫ dt 2π −∞ +∞ jωt 1 v ( ω ) e d ω = L ∫ 2π −∞ jωt +∞ ∫i L (ω )e jωt dω −∞ +∞ ∫ L( jω )i L (ω )e jωt dω −∞ University of California, Berkeley 6 EECS 105 Fall 2004, Lecture 2 z Prof. J. Stephen Smith In each of these, we can eliminate the integration over frequency, and the constant, to get: vr (ω ) = ir (ω ) ⋅ r ic (ω ) = vc (ω ) ⋅ C ( jω ) vc (ω ) = 1 ic (ω ) C ( jω ) vL (ω ) = iL (ω ) ⋅ L( jω ) Department of EECS University of California, Berkeley Conversion of linear circuits to algebraic equations EECS 105 Fall 2004, Lecture 2 Prof. J. Stephen Smith z Something wonderful just happened: each of our simultaneous linear differential equations were just converted to algebraic equations (just multiplication by a constant for these examples), and the same thing happens to every linear circuit. z Of course, the same thing happens to the relationships derived from Kirchoff’s laws (they are linear too; adding voltages, for example) Department of EECS University of California, Berkeley 7 EECS 105 Fall 2004, Lecture 2 Prof. J. Stephen Smith z The advantage of changing differential equations into algebraic equations comes at a small price: the constants that we are multiplying by, and the functions of frequency for both voltage and current, are now complex numbers. z No matter how complicated the circuit, if we drive the circuit with a real function vin (t ) when we find the output by using the inverse Fourier transform, it will be real as well, as well as any voltage or current at any node, at all times. Department of EECS University of California, Berkeley EECS 105 Fall 2004, Lecture 2 Prof. J. Stephen Smith Complex numbers z It is important to think of complex numbers as just an expansion over the definition of real numbers. For example, if A, B, and C are complex: A( B + C ) = AB + AC AB = BA A+ B = B + A This seems trivial, but there is only one* other definition for “numbers” which obeys these properties**: *The other one is “quaternions” **finite, but not countable. Department of EECS University of California, Berkeley 8 EECS 105 Fall 2004, Lecture 2 z Prof. J. Stephen Smith If you have a calculator which can handle complex numbers you can just plug them in. Otherwise, you can use these derived rules to get results for complex numbers from the rules for real numbers* A = ar + ai j B = br + bi j A + B = (ar + br ) + (ai + bi ) j AB = (ar + ai j )(br + bi j ) = ar br − ai bi + a r b j j + ai br j z j is used by electrical engineers for the imaginary constant to avoid confusion with i for current which got there first. *just as we handle reals by approximating with integer calculations and keeping track of decimal points Department of EECS EECS 105 Fall 2004, Lecture 2 z University of California, Berkeley Prof. J. Stephen Smith Notice that unlike the reals, there is a complex number that, when multiplied by itself, gives negative one: A = 0 +1 j AA = 0 − 1 + 0 + 0 = −1 z Almost all functions have extensions over the complex numbers, and in some ways complex numbers seem more “complete” in that the inverses of functions exist, roots can always be found, etc. Department of EECS University of California, Berkeley 9 EECS 105 Fall 2004, Lecture 2 Prof. J. Stephen Smith http://mathworld.wolfram.com/ z z z A complex function is said to be analytic on a region R if it is complex differentiable at every point in R. The terms holomorphic function, differential function, complex differentiable function, and regular function are sometimes used interchangeably with "analytic function" If a function is analytic in a region R, it is infinitely differentiable in R. A function may fail to be analytic at one or more points through the presence of singularities, or along lines or line segments through the presence of branch cuts. A single-valued function that is analytic in all but possibly a discrete subset of its domain, and at those singularities goes to infinity like a polynomial (i.e., these exceptional points must be poles and not essential singularities), is called a meromorphic function. Department of EECS University of California, Berkeley EECS 105 Fall 2004, Lecture 2 Prof. J. Stephen Smith Why introduce complex numbers? z z z They actually make things easier ix One insightful derivation of e Consider a second order homogeneous DE y '' + y = 0 ⎧ sin x y=⎨ ⎩cos x z Since sine and cosine are linearly independent, any solution is a linear combination of the “fundamental” solutions Department of EECS University of California, Berkeley 10 EECS 105 Fall 2004, Lecture 2 Prof. J. Stephen Smith Insight into Complex Exponential z z But note that e jx is also a solution! That means: e jx = a1 sin x + a2 cos x e − jx = − a1 sin x + a2 cos x e jx − e − jx = 2a1 sin x But a number minus its complex conjugate gives an imaginary number so is pure imaginary. Differentiating: a1 je jx + je − jx = 2a1 cos x a1 = ja2 And a2 is real, so: And since e = a ( j sin x + cos x) jx e j 0 = 1 = a ( j sin 0 + cos 0) = a Department of EECS University of California, Berkeley EECS 105 Fall 2004, Lecture 2 Prof. J. Stephen Smith The Rotating Complex Exponential z So the complex exponential is nothing but a point tracing out a unit circle on the complex plane: e ix = cos x + i sin x e Department of EECS i ωt e − i ωt e i ωt + e − i ωt 2 University of California, Berkeley 11 EECS 105 Fall 2004, Lecture 2 Prof. J. Stephen Smith Magic: Turn Diff Eq into Algebraic Eq z Integration and differentiation are trivial with complex numbers: d iωt e = iωe iωt dt z z ∫e iωτ dτ = 1 i ωt e iω Any ODE is now trivial algebraic manipulations … in fact, we’ll show that you don’t even need to directly derive the ODE by using phasors The key is to observe that the current/voltage relation for any element can be derived for complex exponential excitation Department of EECS University of California, Berkeley EECS 105 Fall 2004, Lecture 2 Prof. J. Stephen Smith Complex Exponential is Powerful z To find steady state response we can excite the system with a complex exponential Mag Response e iωt LTI System H H (ω ) ei (ωt +φ ) Phase Response z At any frequency, the system response is characterized by a single complex number H: H (ω ) z This is not surprising since a sinusoid is a sum of complex exponentials (and because of linearity!) sin ωt = z φ =p H (ω ) eiωt − e − iωt 2i cos ωt = eiωt + e − iωt 2 From this perspective, the complex exponential is even more fundamental Department of EECS University of California, Berkeley 12 EECS 105 Fall 2004, Lecture 2 Prof. J. Stephen Smith Remember our low pass filter? + vout vC (t ) vin ic (t ) _ Department of EECS University of California, Berkeley EECS 105 Fall 2004, Lecture 2 Prof. J. Stephen Smith LPF Example: frequency domain z Let’s look at a single frequency from the source: vs (t ) = v0 (t ) + RC dv0 dt vs (t ) = Vs e jωt vo (t ) = V0 e j (ωt +φ ) = V0 e jωt real complex Vs e jωt = V0 e jωt + RC ⋅ jω ⋅V0 e jωt Vs = V0 (1 + jω ⋅τ ) V0 1 = Vs (1 + jω ⋅τ ) Department of EECS University of California, Berkeley 13 EECS 105 Fall 2004, Lecture 2 Prof. J. Stephen Smith Magnitude and Phase Response z The system is characterized by the complex function H (ω ) = z V0 1 = Vs (1 + jω ⋅τ ) The magnitude and phase response: H (ω ) = V0 1 = Vs 1 + (ωτ ) 2 p H (ω ) = − tan −1 ωτ Department of EECS University of California, Berkeley EECS 105 Fall 2004, Lecture 2 Prof. J. Stephen Smith Why did it work? z The system is linear: Re[ y ] = L(Re[ x]) = Re[L( x)] z If we excite system with a sinusoid: vs (t ) = Vs cos ωt = Vs Re[e jωt ] z If we push the complex exp through the system first and take the real part of the output, then that’s the “real” sinusoidal response vo (t ) = Vo cos(ωt + φ ) = Vo Re[e j (ωt +φ ) ] Department of EECS University of California, Berkeley 14