Ordinary Differential Equations

Download as pdf or txt
Download as pdf or txt
You are on page 1of 37

Ordinary Differential Equations

Math for Electronics 1


Andrew Thangaraj
Electrical Engineering
IIT Madras
Introduction
Differential equation
Definition
Suppose f is a function of x. A differential equation is an equation involving f , its
derivatives f ′ , f ′′ , … and other functions of x, which needs to be satisifed for all
applicable values of x.

Examples
f ′ (x) = 4
f ′ (x) + f (x) = 2
f ′′ (x) + 2f ′ (x) − f (x) = sin x

Differential equations govern almost the entire


physical world
Example: Falling object
Newton's laws
Position Speed v ′ (t) = g = 10 m/s2
Examples of
x(0) = 0 v(0) = 0 or differential
x′′ (t) = g equations

Solved by direct integration


x′ (t) = v(t) = 10t + c1
x(t) = 5t2 + c1 t + c2

x(t) v(t) = x′ (t) c1 , c2 : use initial conditions


v(0) = 0 gives c1 = 0
x(0) = 0 gives c2 = 0
x(t) = 5t2 , v(t) = 10t
Example: Falling object with air resistance

air resistance
Position Speed
kv(t) Newton's laws
x(0) = 0 v(0) = 0
mv ′ (t) = mg − kv(t)
or
speed k
v ′ (t) + v(t) = g
v(t) m
v(0) = 0

x(t) v(t) = x′ (t) mg Speed is the solution to


a differential equation
weight
Example: RC circuit with DC source

t=0 R i(t)
Circuit laws
vR (t) + vC (t) = 5
5V C vR (t) = R i(t)
i(t) = CvC′ (t)

′ 1
i (t) + i(t) = 0
RC
i(0) =?

Current is the solution to


a differential equation
Example: RC circuit with AC source

t=0 R i(t)
Circuit laws
vR (t) + vC (t) = 5 sin wt
5 sin wt V + C
− vR (t) = Ri(t)
i(t) = CvC′ (t)

1 5w
i′ (t) + i(t) = cos wt
RC R
i(0) = 0

Current is the solution to


a differential equation
Example: Population models
Population of a species at time t
N (t)

Properties
Rate of increase of N is proportional to N
N ′ (t) ∝ rN (t)
However, population cannot grow forever
Capacity K : maximum sustainable population ′ N (t)
N (t) ∝ 1 −
K
N : small → N (t) grows fast
N : close to K → N (t) grows slower N (t)
N (t) = rN (t) (1 −

)
N = K : growth rate is zero K
N > K : growth rate is negative
Population is the solution
to a differential equation
First-order linear ODE
General f ′ (x) + P (x)f (x) = Q(x)
form
f (x): to be solved
P (x), Q(x): given

Falling object with ′ k


v (t) + v(t) = g
air resistance m Population model
k
P (t) = , Q(t) = g
N (t)
N (t) − (1 − ) N (t) = 0
m ′
K
1

i (t) + i(t) = vs (t) Not linear
RC circuit RC
1
P (t) = , Q(t) = vs (t)
RC
Solution to first-order
linear ODE
Easy case: P (x) = 0
f ′ (x) + P (x)f (x) = Q(x)
P (x) = 0

Example
f ′ (x) = Q(x)
f ′ (x) = sin ω0 t
Solution
f (x) = AQ (x) + c Solution
1
where AQ (x): antiderivative of Q(x) f (x) = (− cos ω0 t) + c
ω0
Constant case: P (x) = p, a constant

f ′ (x) + pf (x) = Q(x)


p: constant

Basic idea: Try to convert to easy case

epx f ′ (x) + pepx f (x) = epx Q(x)


Multiply both
epx 
=0
sides by epx
(epx f (x))′ = epx Q(x)

epx f (x) = Aepx Q (x) + c

f (x) = e−px Aepx Q (x) + ce−px


Examples: Falling object with air resistance

′ k k
v (t) + v(t) = g p = , Q(t) = g
m m

ept Q(t) = ekt/m g


mg kt/m
Aept Q (t) = e
k

mg Initial condition: v(0) = 0


v(t) = + c e−kt/m mg mg
k v(0) = + c = 0 or c = −
k k

mg
v(t) = (1 − e−kt/m )
k
Falling object with air resistance: Plot of solution
mg mg
v(t) = (1 − e−t/(m/k) ) v∞ = Time constant: m/k
k k

mg v∞
k 0.98v∞
0.95v∞
v∞ (1−e−2 )=0.86v∞

v∞ (1−e−1 )=0.63v∞

t
m/k 2m/k 3m/k 4m/k 5m/k
Examples: RC circuit with DC source
1 1
i′ (t) + i(t) = 0 p= , Q(t) = 0
t=0 RC RC
R i(t)

ept Q(t) = 0
5V C
Aept Q (t) = 0

Initial condition: i(0) = 5/R


i(t) = c e−t/RC 5
i(0) = c =
R

5 −t/RC
i(t) = e
R
RC circuit with DC source: Plot of solution
5 −t/RC
i(t) = e i∞ = 0 Time constant: RC
R
5
R

i0 e−1 =0.37i0

i0 e−2 =0.13i0
0.05i0 0.02i0 i∞
RC 2RC 3RC 4RC 5RC t
Examples: RC circuit with AC source

′ 1 5ω
i (t) + i(t) = cos ωt
t=0 R i(t) RC R
1 5ω
p= , Q(t) = cos ωt
RC R
5 sin ωt V + C

5ω t/RC
ept Q(t) = e cos ωt
R

Anti- Aept Q (t) = ?


derivative
Anti-derivative of ept cos ωt
ept (eiωt + e−iωt ) 1 (p+iω)t
e cos ωt =
pt
= (e + e(p−iω)t )
2 2

Anti- 1 e(p+iω)t e(p−iω)t ept


( + )= (p(eiωt
+ e−iωt
) − iω(eiωt
− e−iωt
))
derivative 2 p + iω p − iω 2 2
2(p + ω )
ept
= 2 2
(p cos ωt − (iω)i sin ωt)
p +ω

( sin ωt)
ept p ω p
= cos ωt + sin ϕ =
p2 + ω 2 p2 + ω 2 p2 + ω 2 p2 + ω 2
ω
ept cos ϕ =
= (sin ϕ cos ωt + cos ϕ sin ωt) p2 + ω 2
p2 + ω 2
ept p
= sin(ωt + ϕ) tan ϕ =
ω
p2 + ω2
Examples: RC circuit with AC source (contd)

1 5ω 5ω et/RC

i (t) + i(t) = cos ωt Aept Q (t) = sin(ωt + ϕ)
R 2
(1/RC) + ω 2
RC R
1 5ω 1
p=
RC
, Q(t) =
R
cos ωt Impedance: Z = R + 1
iωC
tan ϕ =
ωRC
5ω t/RC 5et/RC
e Q(t) =
pt
e cos ωt Aept Q (t) = sin(ωt + ϕ)
R ∣Z∣

5 Initial condition: i(0) = 0


i(t) = sin(ωt + ϕ) + c e−t/RC −5
∣Z∣ c= sin ϕ
∣Z∣

5
i(t) = (sin(ωt + ϕ) − sin ϕ e−t/RC )
∣Z∣
RC circuit with AC source: Plot of solution
5 5
i(t) = (sin(ωt + ϕ) − sin ϕ e−t/RC ) i∞ (t) = sin(ωt+ϕ)
∣Z∣ ∣Z∣

i∞ (t)

RC 2RC 3RC
5
sin ϕe−t/RC
∣Z∣

i(t)
Second-order linear ODEs
Constant coefficients
Example: RLC circuit

t=0 Circuit laws


R i(t) L
vR (t) + vL (t) + vC (t) = vs (t)
vR (t) = R i(t), vL (t) = L i′ (t), i(t) = CvC′ (t)
vs (t) + C

Differentiating
vL′ (t) + vR′ (t) + vC′ (t) = vs′ (t)
Two cases
DC: vs (t) constant 1
Li (t) + Ri (t) + i(t) = vs′ (t)
′′ ′
AC: vs (t) = a sin ωt C

Second-order ODE
Linear with constant coefficients
Second-order linear ODEs with constant coefficients

af ′′ (x) + bf ′ (x) + cf (x) = Q(x)


a, b, c: real constants

Models many practical scenarios


Solutions are more varied in structure
Method of solution involves some guesswork
Guesses are based on Q(x)
Homogeneous case: Q(x) = 0

af ′′ (x) + bf ′ (x) + cf (x) = 0


a, b, c: real constants

Guess: f (x) = esx


s: constant, but what value?

Guess works if
a(esx )′′ + b(esx )′ + cesx = (as2 + bs + c)esx = 0

Since esx 
= 0, we require
Solve quadratic
as2 + bs + c = 0 equation to find s
Homogeneous case: Distinct real roots
af ′′ (x) + bf ′ (x) + cf (x) = 0
Guess: f (x) = esx
Roots of as2 + bs + c = 0: s1 , s2 , real, s1 
= s2

Solutions: es1 x and es2 x

Linear combination property


If f1 (x) and f2 (x) are solutions, then c1 f1 (x) + c2 f2 (x) are also solutions.

General solution: f (x) = c1 es1 x + c2 es2 x

How to find c1 , c2 ?
Initial conditions: suppose f (x0 ) and f ′ (x0 ) are known
Find c1 , c2 to satisfy initial conditions
Example
Solve f ′′ (x) − 6f ′ (x) + 8f (x) = 0 with f (0) = f ′ (0) = 1.

Solve
General solution
s2 − 6s + 8 = 0
f (x) = c1 e2x + c2 e4x
to get s = 2, 4.
f (0) = c1 + c2 = 1
f ′ (0) = 2c1 + 4c2 = 1

Solving, c2 = −1/2, c1 = 3/2

Solution: f (x) = 32 e2x − 12 e4x


Homogeneous case: Repeated real roots
af ′′ (x) + bf ′ (x) + cf (x) = 0
Guess: f (x) = esx
Roots of as2 + bs + c = 0: s1 , s1 , real

Solution: es1 x

Property
For real repeated roots, xes1 x is another solution.

General solution: f (x) = c1 es1 x + c2 xes1 x

How to find c1 , c2 ?
Initial conditions: suppose f (x0 ) and f ′ (x0 ) are known
Find c1 , c2 to satisfy initial conditions
Example
Solve f ′′ (x) − 6f ′ (x) + 9f (x) = 0 with f (0) = f ′ (0) = 1.

Solve
General solution
s2 − 6s + 9 = 0
f (x) = c1 e3x + c2 xe3x
to get s = 3, 3.
f (0) = c1 = 1
f ′ (0) = 3c1 + c2 = 1

Solving, c1 = 1, c2 = −2

Solution: f (x) = (1 − 2x)e3x


Homogeneous case: Complex conjugate roots
af ′′ (x) + bf ′ (x) + cf (x) = 0
Guess: f (x) = esx
Roots of as2 + bs + c = 0: r + it, r − it, complex

Solutions: erx eitx = erx cos tx + ierx sin tx and erx e−itx = erx cos tx − ierx sin tx

By linear combination property,


solutions are erx cos tx and erx sin tx

General solution: f (x) = erx (c1 cos tx + c2 sin tx)

How to find c1 , c2 ?
Initial conditions: suppose f (x0 ) and f ′ (x0 ) are known
Find c1 , c2 to satisfy initial conditions
Example
Solve f ′′ (x) − 5f ′ (x) + 8f (x) = 0 with f (0) = f ′ (0) = 1.

Solve
General solution
s2 − 5s + 8 = 0
5 ± 7i f (x) = e5x/2 (c1 cos( 7x/2) + c2 sin( 7x/2))
to get s =
2
f (0) = c1 = 1
f ′ (0) = (5/2)c1 + ( 7/2)c2 = 1

Solving, c1 = 1, c2 = −3/ 7

Solution: f (x) = e5x/2 (cos( 7x/2) − (3/ 7) sin( 7x/2))


Non-homogeneous case

af ′′ (x) + bf ′ (x) + cf (x) = Q(x)


a, b, c: real constants

Property
Suppose g(x) is a solution of af ′′ (x) + bf ′ (x) + cf (x) = Q(x)
and
h(x) is a solution of af ′′ (x) + bf ′ (x) + cf (x) = 0,
then
g(x) + h(x) is a solution of af ′′ (x) + bf ′ (x) + cf (x) = Q(x).

h(x): solution of homogeneous equation g(x): called "particular" solution


We can find general solutions. How to get it?
Guess for particular solution
af ′′ (x) + bf ′ (x) + cf (x) = Q(x)

Q(x) = d Q(x) = u sin x + v cos x

Guess f (x) = e Guess f (x) = r sin x + s cos x

Example Example
f ′′ (x) + 2f ′ (x) + 5f (x) = sin x
f ′′ (x) + 2f ′ (x) + 5f (x) = 4
(−r sin x − s cos x) + 2(r cos x − s sin x) +
f (x) = e: 5e = 4 or e = 4/5
5(r sin x + s cos x) = sin x
f (x) = 4/5
4r − 2s = 1, 2r + 4s = 0

f (x) = (1/5) sin x − (1/10) cos x


Example: RLC series circuit with DC source

t=0 R i(t) L Equation is homogeneous


s2 + 2αs + ω02 = 0
+ Solutions
Vdc − C
−α ± α2 − ω02

i′′ (t) + 2αi′ (t) + ω02 i(t) = 0 Overdamped: α > ω0 (two real roots)
R 2 1
α= , ω0 =
2L LC
Critical: α = ω0 (repeated real roots)
Initial conditions
Vdc

i(0) = 0, i (0) = Underdamped: α < ω0 (complex conjugate roots)
L
DC RLC series circuit: Solutions

ωd = ∣ω02 − α2 ∣ ζ=0.4 α
i(t) ζ=
ω0
ζ=0.6
Overdamped α > ω0
−αt ωd t −ωd t 0.8 Over: ζ > 1
i(t) = A e (e −e )
1 Critical: ζ = 1
Under: ζ < 1
1.5
Critically damped α = ω0
i(t) = B t e−αt 2
3
Underdamped α < ω0 i∞ =0
i(t) = Ce−αt sin ωd t t

A, B, C : chosen to satisfy i′ (0) = Vdc /L ω0 = 1, i′ (0) = 1


Example: RLC series circuit with AC source
Homogeneous: done previously
t=0 R i(t) L This will give the transient itr (t)

Particular solution
+
a sin ωt − C i∞ (t) = p sin ωt + q cos ωt

(ω02 − ω 2 )p = 2αωq
′′ ′
i (t) + 2αi (t) + ω02 i(t)
= (aω/L) cos wt (ω02 − ω 2 )q + 2αωp = aω/L
R 2 1 1
α= , ω =
2L 0 LC Steady state Z = R + iωL +
a iωC
Initial conditions i∞ (t) = sin(ωt − ϕ) ω 2 − ω02
∣Z∣ tan ϕ =
2αω
i(0) = 0, i′ (0) = 0

i(t) = itr (t) + i∞ (t), i(0) = i′ (0) = 0


Example: LC oscillator
t=0 i(t) Homogeneous equation Complex conjugate roots
s2 + ω02 = 0 s = iω0 , −iω0
+ +
L vL (t) C vC (t) Solution
− −
i(t) = A sin ω0 t + B cos ω0 t

Initial conditions Using initial conditions


vC (0) = 5, i(0) = 0, i′ (0) = 5/L 5
i(t) = sin ω0 t
ω0 L
Circuit laws 1
ω02 =
vL (t) = Li′ (t) LC
LC oscillator
−i(t) = CvC′ (t) Converts an initial capacitor charge
i′′ (t) + ω02 i(t) = 0
vL (t) − vC (t) = 0 into a pure sine wave!
In conclusion
Hope you have enjoyed an introduction to
the beauty and utility of mathematics!

The basic method of mathematical problem solving


Assign variables to quantities of interest
Explore relationships between them
Algebraic (linear, quadratic, polynomial etc)
Analytic (real and complex calculus)
Start with simple relationships
Deduce complicated relationships by logic and clever manipulation

You now have most of the mathematical tools needed for


basic circuit analysis and study of signals.

Best wishes and see you in Math 2!

You might also like