Agenda for differential equations 1. Complex numbers 2. Differential calculus 3. Integral calculus 4. Modeling 5. Element equations 6. System equations 7. Differential equations 8. Solving differential equations 9. Differential equations 1 1. Complex numbers Definition Arithmetic In-phase and quadrature 9. Differential equations 1. Complex numbers 2 Definition A complex number, z, consists of the sum of a real and imaginary number. The symbols i and j have the value of the square root of -1 Example imaginary axis a+bi b a=3 b=4 z = a + bi z = 3 + 4i r real axis a 9. Differential equations 1. Complex numbers 3 Arithmetic (1 of 2) Addition: (a+bj) + (c+dj) = (a+c)+(b+d)j Subtraction: (a+bj) - (c+dj) = (a-c)+(b-d)j Multiplication: (a+bj)(c+dj) = (ac-bd)+(cb+da)j Conjugate: conj(a+bj) = a-bj Absolute: abs(a+bj) = sqrt(a2+b2) Argument: arg(a+bj) = atan2(b,a) Division: (a+bj)/(c+dj) = (a+bj) conj(c+dj)/ [abs(c+dj)]2 a+bj = r x ej where r = abs(a+bj ) and = arg(a+bj ) 9. Differential equations 1. Complex numbers 4 Arithmetic (2 of 2) Complex numbers c1 add ImSum 1+2i subtract ImSub 1+2i multiply ImProduct 1+2i division ImDiv 1+2i conjugate ImConjugate1+2i absolute ImAbs 1+2i argument ImArgument 1+2i c2 3+4i 3+4i 3+4i 3+4i results 4+6i -2-2i -5+10i 0.44+8E-002i 1-2i 2.24 1.11 63.4 Complex arithmetic using Excel 9. Differential equations 1. Complex numbers 5 In-phase and quadrature (I&Q) In-phase = component of signal that is in-phase with reference Quadrature = component of signal that is 90 degrees out of phase with reference 9. Differential equations 1. Complex numbers 6 2. Differential calculus Derivative of a function Elementary derivative operations Examples Critical points Partial differentiation 9. Differential equations 2. Differential calculus 7 Derivative of a function Lim f (x) x 0 9. Differential equations f(x) x 2. Differential calculus 8 Elementary derivative operations D k = 0 D xn = nxn-1 D ln x = 1/x D eax = a eax 9. Differential equations 2. Differential calculus 9 Examples (1 of 2) D k f(x) = k D f(x) D (f(x) g(x)) = D f(x) D g(x) D (f(x) g(x)) = f(x) D g(x) + g(x) D f(x) D (f(x)/g(x)) = [g(x) D f(x) - f(x) D g(x)]/g(x)2 D [f(x)]n = n[f(x)]n-1 D f(x) D f (g(x)) = Dg (f(g)) Dx g(x) 9. Differential equations 2. Differential calculus 10 Examples (2 of 2) D sin x = cos x D cos x = -sinx D tan x = sec2x D arcsin x = 1/sqrt(1 - x2) D arctan x = 1/(1 + x2) 9. Differential equations 2. Differential calculus 11 Critical points f ‘ (x) = 0 at critical point f “ (x) < 0 at maximum point f “ (x) > 0 at minimum point f “ (x) = 0 at inflection point f (x) local maximum inflection point local minimum global minimum singular point x 9. Differential equations 2. Differential calculus 12 Partial differentiation A partial derivative is a derivative that is taken with respect to only one variable z = 4x3 - 5y2 + 2xy + y -12 z/ x = 12x2 + 2y Partial derivatives are important in finite element computations 9. Differential equations 2. Differential calculus 13 3. Integral calculus Integration Elementary integration operations Examples Integration by parts Initial values Definite integral 9. Differential equations 3. Integral calculus 14 Integration Integration is the inverse operation of differentiation f ‘ (x) dx = f (x) + C 9. Differential equations 3. Integral calculus 15 Elementary integration operations k dx = k x + C xm dx = xm+1/(m+1) + C e kx dx = ekx/k + C 9. Differential equations 3. Integral calculus 16 Examples sin x dx = -cos x +C 1/x dx = | ln x | + C ln x dx = x ln x - x + C dx/(k2 + x2) = I/k arctan(x/k) + C 9. Differential equations 3. Integral calculus 17 Integration by parts (1 of 3) Integration by parts is an integration technique that is used when the function can be partitioned into two parts with favorable properties f(x) dg(x) = f(x)g(x) - 9. Differential equations 3. Integral calculus g(x) df(x) +C 18 Integration by parts (2 of 3) f(x) dg(x) x2 ex dx 2x ex df(x) g(x) x2 ex dx = x2 ex - 9. Differential equations ex (2x) dx + C 3. Integral calculus 19 Integration by parts (3 of 3) f(x) dg(x) 2x ex dx 2 ex df(x) g(x) ex (2x) dx = 2x ex - ex (2) dx + C = 2x ex - 2 ex x2 ex dx = x2 ex - 2x ex + 2 ex + C 9. Differential equations 3. Integral calculus 20 Initial values The constant of integration C can be found only if the value of the function is known at a point If there are multiple integrations involved, then multiple initial values are needed Example, if f(x) = 4 when x = 1 then (3x2 - 2x)dx = x3- x2 + C 13 - 12 + C = 4 C=4 9. Differential equations 3. Integral calculus 21 Definite integrals A definite integral is restricted to the region bounded by lower and upper limits x2 f ‘(x) dx = f(x2 ) - f(x1) x1 2 2x dx = x2(2) - x2(1) = 22 - 12 = 3 1 9. Differential equations 3. Integral calculus 22 4. Modeling Approaches to finding a model Linear systems Nonlinear systems Guidelines for equations 9. Differential equations 4. Modeling 23 Approaches to finding a model 1. Lumped parameters • Break system into smaller elements • For each element, use the physical laws that govern the element to write equations • Build a model of the system from these lumped parameters 2. System identification • Stimulate the system and observe its response • Works only with existing systems 9. Differential equations 4. Modeling 24 Linear systems (1 of 3) A system is linear if and only if it obeys the principle of superposition • H(x1 + x2) = H(x1) + H(x2), where H is the system response 9. Differential equations 4. Modeling 25 Linear systems (2 of 3) system response x1 H y = H(x1 + x2) x2 9. Differential equations x 4. Modeling 26 Linear systems (3 of 3) y1 +y2 slope K y2 y1 x1 9. Differential equations x2 4. Modeling x1 +x2 27 Nonlinear systems (1 of 3) Occasionally, application of physical laws to a system result in nonlinear equations. The nonlinearity may be overcome by finding a limited region of operation where linear operation takes place 9. Differential equations 4. Modeling 28 Nonlinear systems (2 of 3) (y1 +y2) slope K y2 y1 c x1 9. Differential equations x2 x1 +x2 4. Modeling 29 Nonlinear systems (3 of 3) (y1 +y2) y2 y1 c x1 9. Differential equations x2 4. Modeling x1 +x2 30 Guidelines for equations (1 of 4) 1. Understand the system -- sketch or describe in qualitative terms 2. Identify inputs and outputs, including disturbances 3. Express system in terms of elements that can be expressed mathematically 4. Develop equations for each element 9. Differential equations 4. Modeling 31 Guidelines for equations (2 of 4) 5. Determine unknown parameter values by analysis or experiment 6. Adjust the model until it produces behavior like the actual system 7. Simplify the system if nonlinearities are involved 9. Differential equations 4. Modeling 32 Guidelines for equations (3 of 4) Ideally, the relationship should be linear A lumped-parameter model has time as its only independent variable. This fact allows ordinary differential equations to be used. If there are more independent variables, partial differential equations would need to be used, and they are more difficult Use idealized equivalent of the system; e.g. • Mass concentrated at a point rather than distributed • Inductors have no resistance or capacitance 9. Differential equations 4. Modeling 33 Guidelines for equations (4 of 4) The number of variables and the number of equations needs to be the same. Units need to be consistent Need to validate the model with prototypes or data from similar systems In practice, systems are not truly linear. Variations in the plant or transducers can make design much harder 9. Differential equations 4. Modeling 34 5. Element equations Proportional (P) relationship Integral (I) relationship Derivative (D) relationship PID Electrical components Rectilinear mechanical components Rotational mechanical components Fluid component Thermal components 9. Differential equations 5. Element equations 35 Proportional (P) relationship v(t) i(t) i(t) a b R i(t) = current (A) = through variable v(t) = voltage (V) = across variable R = resistance () i(t) = 1/R v(t) through variable = constant * across variable 9. Differential equations 5. Element equations 36 Integral (I) relationship v(t) i(t) i(t) a b L i(t) = current (A) = through variable v(t) = voltage (V) = across variable L = inductance (H) i(t) = 1/L v(t) dt through variable = constant * ( across variable) dt 9. Differential equations 5. Element equations 37 Derivative (D) relationship v(t) i(t) i(t) a b C i(t) = current (A) = through variable v(t) = voltage (V) = across variable C = capacitance (F) i(t) = C d/dt v(t) through variable = constant * d/dt( across variable) 9. Differential equations 5. Element equations 38 PID Proportional (P) -- through variable is proportional to across variable Integral (I) -- through variable is proportional to integral of across variable Derivative (D) -- through variable is proportional to derivative of across variable 9. Differential equations 5. Element equations 39 Electrical components •Across variable: potential difference v (V) •Through variable: current I (A) P -- Resistor R() I -- Inductor L(H) D -- Capacitor C(F) 9. Differential equations 5. Element equations 40 Rectilinear mechanical components •Across variable: linear velocity v(m/s) •Through variable: force f(N) P -- Linear damper B(N/ms-1) I -- Linear spring K(N/m) D -- Mass M(kg) 9. Differential equations 5. Element equations 41 Rotational mechanical components •Across variable: angular velocity (rad/s) •Through variable: torque T(Nm) P -- Angular damper B(Nm/rads-1) I -- Angular spring K(Nm/rad) D -- Inertia J(Nm/rads-2) 9. Differential equations 5. Element equations 42 Fluid components •Across variable: pressure head h(m) •Through variable: volume flow rate q(m 3s-1) P -- fluid resistance 1/R(m2/s) D -- fluid capacity A(m2) 9. Differential equations 5. Element equations 43 Thermal components •Across variable: temperature difference (K) •Through variable: heat flow rate q(W) P -- thermal resistance 1/R(W/K) D -- thermal capacity C(J/K) 9. Differential equations 5. Element equations 44 6. System equations Example -- suspension 9. Differential equations 6. System equations 45 Example -- suspension body displacement x(t) body mass spring, k shock absorber, b m d2x/dt2 = -b dx/dt - k x wheel 9. Differential equations 6. System equations 46 7. Differential equations (de) Definition of de Order of a de Linear de Linear de with constant coefficients Nonlinear de Homogeneous de Nonhomongeneous de Auxiliary equation 9. Differential equations 7. Differential equations 47 Definition of de A differential equation is a mathematical expression combining a function (e.g., y=f(x)) and one or more of its derivatives Examples • dy/dx - 5 y = 0 • d2y/dx2 - 3 dy/dx + 2y = 0 • d2y/dx2 - (x2+5) [dy/dx]2 + y = sin 2x 9. Differential equations 7. Differential equations 48 Order of a de The order of a differential equation is the order of the highest derivative in the equation Examples • dy/dx - 5 y = 0 -- 1st • d2y/dx2 - 3 dy/dx + 2y = 0 -- 2nd • d2y/dx2 - (x2+5) [dy/dx]2 + y = sin 2x -- 2nd 9. Differential equations 7. Differential equations 49 Linear de A linear differential equation is an equation consisting of a sum of terms each made of a multiplier and either the function or its derivatives Examples • dy/dx - 5 y = 0 -- linear • d2y/dx2 - 3 dy/dx + 2y = 0 -- linear • d2y/dx2 - (x2+5) [dy/dx]2 + y = sin 2x -- nonlinear 9. Differential equations 7. Differential equations 50 Linear de with constant coefficients If the multipliers are constant, then the differential equation is said to have constant coefficients Examples • dy/dx - 5 y = 0 -- constant coefficients • dy/dx - 5 xy = 0 -- non- constant 9. Differential equations 7. Differential equations 51 Nonlinear de If the function or one of its derivatives is raised to a power or embedded in another function, the differential equation is nonlinear Example • d2y/dx2 - (x2+5) [dy/dx]2 + y = sin 2x -nonlinear 9. Differential equations 7. Differential equations 52 Homogeneous de A homogeneous differential equation is one in which each term contains either the function or its derivatives. In other words, the sum of the derivative terms is zero Examples • dy/dx - 5 y = 0 -- homogeneous • d2y/dx2 - 3 dy/dx + 2y = 0 -homogeneous 9. Differential equations 7. Differential equations 53 Nonhomogeneous de A nonhomogeneous differential equation is a sum of derivative terms that doesn’t equal zero Example • d2y/dx2 - (x2+5) [dy/dx]2 + y = sin 2x -non-homogeneous 9. Differential equations 7. Differential equations 54 Auxiliary equation The auxiliary equation is the polynomial formed by replacing all derivatives in a linear, constant coefficient, homogeneous differential equation with variables raised to the the power of the respective derivatives Example • d2y/dx2 - 3 dy/dx + 2y = 0 has an auxiliary equation of s2 - 3s + 2 = 0 9. Differential equations 7. Differential equations 55 8. Solving differential equations Introduction Examples Alternate expression 9. Differential equations 8. Solving differential equations 56 Introduction There are a large number of types of differential equations Many types have closed form solutions; others do not A type of differential equations of importance to engineering is the linear, non-homogeneous differential equation with constant coefficients 9. Differential equations 8. Solving differential equations 57 Example 1 de: Dy - 2y = 0 auxiliary equation: S - 2 = 0 root: +2 solution: y = C e+2x if y(0) = 10, then C = 10 9. Differential equations 8. Solving differential equations 58 Example 2 de: D2y + 3 Dy + 2y = 0 auxiliary equation: S2 + 3S + 2 = 0 roots: -1, -2 solution: y = C1 e-2x + C2 e-x if y(0) = 0, Dy(0) = -1, then C1 =1 and C2 = -1 9. Differential equations 8. Solving differential equations 59 Example 3 de: D2y + y = 0 auxiliary equation: S2 + 1 = 0 roots: +i, -i solution: y = C1 cos x + C2 sin x 9. Differential equations 8. Solving differential equations 60 Example 4 de: D2y +2Dy + 2y = 0 auxiliary equation: s2 + 2s + 2 = 0 roots: -1 + i, -1 - i solution: y = C1 e-x cos x + C2 e-x sin x 9. Differential equations 8. Solving differential equations 61 Example 5 de: D2y +2Dy + y = 0 auxiliary equation: S2 + 2S +1 = 0 roots: -1 , -1 solution: y = (C1 + C2 x ) e-x 9. Differential equations 8. Solving differential equations 62 Example 6 de: D5y = 0 auxiliary equation: S5 = 0 roots: 0, 0, 0, 0, 0 solution: y = C1 + C2 x + C3x2 + C4 x3 + C5x4 9. Differential equations 8. Solving differential equations 63 Example 7 de: D4y + 4 D3y +8 D2y + 8 Dy +4 y = 0 auxiliary equation: s4 + 4 s3 +8 s2 + 8 s +4 = (s2 + 2s + 2)( s2 + 2s + 2) = 0 roots: -1 + i, -1 - i, -1 + i, -1 - i solution: y = (C1 + C2 x) e-x cos x + (C3 + C4 x) e-x sin x 9. Differential equations 8. Solving differential equations 64 Example 8 (1 of 2) de: D2y + Dy - 2y = 2x -40 cos 2x homogeneous auxiliary equation: s2 + s - 2 = 0 homogeneous roots: 1, -2 homogeneous solution: yc = C1 e+x + C2 e-2x particular roots: 0, 0, +2i, -2i particular solution: yp = A + Bx + C cos 2x + E sin 2x total solution: y = yc + yp 9. Differential equations 8. Solving differential equations 65 Example 8 (2 of 2) -2 yp = -2A -2Bx -2C cos 2x -2E sin 2x D yp = B + 2Ecos2x - 2C sin 2x D2 yp =-4C cos 2x -4E sin 2x constant terms : -2A + B =0 X terms: -2B = 2 cos x terms: -2C + 2E -4C = -40 sin x terms: -2E -2C -4E = 0 constants: A = -0.5. B = -1, C = 6, E = -2 9. Differential equations 8. Solving differential equations 66 Example 9 (1 of 2) de: D2y + y = sin x homogeneous auxiliary equation: s2 + 1 = 0 homogeneous roots: +i, -i homogeneous solution: yc = C1 cos x + C2 sin x particular roots: +i, -i particular solution: yp = Ax cos x + Bx sin x total solution: y = yc + yp 9. Differential equations 8. Solving differential equations 67 Example 9 (2 of 2) yp = Ax cos x + Bx sin x D yp = A cos x - Ax sin x + B sin x +Bx cos x D2 yp = -2A sin x - Ax cos x + 2B cos x - Bx sin x cos x terms: 2B = 0 sin x terms: -2A = 1 constants: A = -0.5, B = 0 9. Differential equations 8. Solving differential equations 68 Example 10 (1 of 1) de: D3y - Dy = 4 e-x + 3 e2x homogeneous auxiliary equation: s3 - s = 0 homogeneous roots: 0, +1, -1 homogeneous solution: yc = C1 + C2 e+x + C3 e-x particular roots: -1, 2 particular solution: yp = Ax e-x + B e2x total solution: y = yc + yp 9. Differential equations 8. Solving differential equations 69 Example 10 (2 of 2) yp = Ax e-x + B e2x D yp = A e-x - Ax e-x + 2 B e2x D2 yp =-2A e-x + Ax e-x + 4 B e2x D3 yp =3A e-x - Ax e-x + 8 B e2x e-x terms: -A + 3A = 4 e2x terms: -2B + 8B = 3 constants: A = 2. B = 0.5 9. Differential equations 8. Solving differential equations 70 Example 11 In the previous problem, y(0) = 0, Dy(0) = -1, D2 y(0) = 2 Determine C1, C2, C3 Use the general solution: y = C1 + C2 e+x + C3 e-x + 2x e-x + 0.5 e2x Dy = C2 e+x - C3 e-x - 2x e-x + 2e-x + e2x D2 y = C2 e+x + C3 e-x + 2x e-x - 4e-x + 2e2x y(0) = 0 = C1 + C2 + C3 + 0.5 Dy(0) = -1 = C2 - C3 + 3 D2 y(0) = 2 = C2 + C3 -2 C1 = -4.5, C2 = 0, C3 = 4 9. Differential equations 8. Solving differential equations 71 Example 12 (1 of 3) de: D2 y + 2D y + 2y = cos x homogeneous auxiliary equation: s2 + 2s + 2 =0 homogeneous roots: -1+i, -1-i homogeneous solution: yc = C1 e-x cos x + C2 e-x sin x particular roots: +i, -i particular solution: yp = A cos x + B sin x total solution: y = yc + yp 9. Differential equations 8. Solving differential equations 72 Example 12 (2 of 3) yp = A cos x + B sin x D yp = - A sin x + B cos x D2 yp = - A cos x - B sin x cos x terms: -A +2B +2A = 1 sin x terms: -B -2A + 2B = 0 constants: A = 0.2, B = 0.4 9. Differential equations 8. Solving differential equations 73 Example 12 (3 of 3) Use the general solution: y = C1 e-x cos x + C2 e-x sin x + 0.2 cos x + 0.4 sin x initial conditions: y(0) = 1, D y(0) = 0 Dy = - C1 e-x cos x - C2 e-x sin x - C1 e-x sin x + C2 e-x cos x - 0.2 sin x + 0.4 cos x y(0) = 1 = C1 + 0.2 Dy(0) = 0 = - C1 + C2 + 0.4 C1 = 0.8, C2 = 0.4 y(x) = 0.8 e-x cos x + 0.4 e-x sin x + 0.2 cos x + 0.4 sin x 9. Differential equations 8. Solving differential equations 74 Alternate expression (1 of 3) It is sometimes desirable to express a higher-order differential equation as a set of first-order equations • Matrix representation • Computer solutions 9. Differential equations 8. Solving differential equations 75 Alternate expression (2 of 3) Example • D3y + 2 D2Y + 5Dy + 10y = r • Choose • y1 = y • y2 = Dy = Dy1 • y3 = D2y = Dy2 • Single equation replaced by three equations • Dy1 = y2 • Dy2 = y3 • Dy3 = r - 10 y1 - 5y2 - 2y3 9. Differential equations 8. Solving differential equations 76 Alternate expression (3 of 3) • Matrix format Dy1 Dy2 Dy3 9. Differential equations = 0 1 0 0 0 1 -10 -5 -2 y1 y2 y3 8. Solving differential equations + 0 0 r 77