Homework 4: SOLUTIONS: Drexel University, College of Engineering 2017-2018 Academic Year
Homework 4: SOLUTIONS: Drexel University, College of Engineering 2017-2018 Academic Year
Homework 4: SOLUTIONS: Drexel University, College of Engineering 2017-2018 Academic Year
Homework 4: SOLUTIONS
Note it is homogeneous and has constant coefficients. Solve this IVP for y(t) by completing these steps.
𝑟 3 + 3𝑟 + 2 = (𝑟 + 1)(𝑟 + 2) = 0
b. The roots of the auxiliary equation are: 𝑟4 = −1, 𝑟3 = −2 The discriminant is: 𝐷 = 𝑏3 − 4𝑎𝑐 = 9 − 8 = 1 > 0
c. The general solution is: (use constants 𝑐4 and 𝑐3 ) 𝑦(𝑡) = 𝑐4 𝑒 @AB + 𝑐3 𝑒 @CB = 𝑐4 𝑒 DB + 𝑐3 𝑒 D3B
d. Now solve the IVP, that is, find the coefficients 𝑐4 and 𝑐3 so that 𝑦(0) = 1, 𝑦 & (0) = 2.
𝑦(0) = 𝑐4 + 𝑐3 = 1
& 𝑐4 = 4, 𝑐3 = −3
𝑦 (0) = −𝑐4 − 2𝑐3 = 2 Inverse matrix
1 1 𝑐4 𝑦(0) 1 1 𝑐4 1 𝑐4 4 −2 −1 1 4
or using matrices: E F G𝑐 H = E F à G H G𝑐 H = G H à G𝑐 H = ∙ G HG H = G H
𝑟4 𝑟3 3 𝑦′(0) −1 −2 3 2 3 D4 1 1 2 −3
The unique solution for this IVP is:
Displacement Phase Plot
DB D3B 1.5 2
𝑦(𝑡) = 4𝑒 − 3𝑒
1
1.5
y(t)
0 -0.5
-1 -1
0 2 4 6 0 0.5 1 1.5
Time in seconds y
1
Drexel University, College of Engineering 2017-2018 Academic Year
We can get a fuller picture of this system using pplane8. First recast the 2nd-order DE as a first-order system, making the standard
substitutions:
𝑦4 = 𝑦, 𝑦3 = 𝑦′
Thus:
𝑑 𝑦4 (𝑡) 𝑦3 𝑦3 𝑦
E F = G H = G−2𝑦 − 3𝑦 H = G 0 1 H G𝑦4 H
𝑑𝑡 𝑦3(𝑡) 𝑦′′ 4 3 −2 −3 3
We can also see the phase portrait includes two straight lines
2
Drexel University, College of Engineering 2017-2018 Academic Year
37
𝐃𝐄: 𝑦 && + 𝑦 & + 𝑦 = 0 𝐈𝐂: 𝑦(0) = 1, 𝑦 & (0) = 2
4
Note it is homogeneous and has constant coefficients. Solve this IVP for y(t) by completing these steps.
37 4 4
a. The auxiliary (or characteristic) equation is: 𝑟3 + 𝑟 + 4
= M𝑟 + 3 − 3𝑗O M𝑟 + 3 + 3𝑗O = 0
c. The general solution is: (use constants 𝑐4 and 𝑐3 ) 𝑦(𝑡) = 𝑒 DB/3 (𝑐4 cos 3𝑡 + 𝑐3 sin 3𝑡) = 𝑒 [B (𝑐4 cos 𝛽𝑡 + 𝑐3 sin 𝛽𝑡 )
d. Now solve the IVP, that is, find the coefficients 𝑐4 and 𝑐3 so that 𝑦(0) = 1, 𝑦 & (0) = 2.
𝑦(0) = 𝑐4 = 1 ]
&( \ 𝑐4 = 1, 𝑐3 = ^
𝑦 0) = − 3A + 3𝑐3 = 2
]
The unique solution for this IVP is: 𝑦(𝑡) = 𝑒 DB/3 Mcos 3𝑡 + sin 3𝑡O
^
Inverse matrix
1 0 𝑐4 𝑦(0) 1 0 𝑐4 1 𝑐4 4 3 0 1 1
or using matrices: E F G𝑐 H = E F à _− 4 3 ` G𝑐 H = G H à G𝑐 H = ∙ _ 4 1` G H = E5c F
𝛼 𝛽 3 𝑦′(0) 3 3 2 3 a
3 2 6
1.5
and its derivative. Uses code similar to lab 4. 1
y(t)
1
0
0.5
-1 0
0 2 4 6 8
dy/dt
0 -1.5
y'(t)
-2
-2
-2.5
-4 -3
0 2 4 6 8 -1 0 1 2
Time in seconds y
The solution spirals into the origin.
3
Drexel University, College of Engineering 2017-2018 Academic Year
We can get a fuller picture of this system using pplane8. First recast the 2nd-order DE as a first-order system, making the standard
substitutions:
𝑦4 = 𝑦, 𝑦3 = 𝑦′
Thus:
𝑦3 0 1 𝑦
𝑑 𝑦4 (𝑡) 𝑦3
E F = G H = d 37 e = d 37 e G 4H
𝑑𝑡 𝑦3 (𝑡) 𝑦′′ − 𝑦4 − 𝑦3 − −1 𝑦3
4 4
4
Drexel University, College of Engineering 2017-2018 Academic Year
17
𝐃𝐄: 𝑦 && − 𝑦 & + 𝑦 = 0 𝐈𝐂: 𝑦(0) = −100, 𝑦 & (0) = 0
4
Note it is homogeneous and has constant coefficients. Solve this IVP for y(t) by completing these steps.
17 4 4
a. The auxiliary (or characteristic) equation is: 𝑟3 − 𝑟 + 4
= M𝑟 − 3 − 2𝑗O M𝑟 − 3 + 2𝑗O = 0
c. The general solution is: (use constants 𝑐4 and 𝑐3 ) 𝑦(𝑡) = 𝑒 B/3 (𝑐4 cos 2𝑡 + 𝑐3 sin 2𝑡) = 𝑒 [B (𝑐4 cos 𝛽𝑡 + 𝑐3 sin 𝛽𝑡)
d. Now solve the IVP, that is, find the coefficients 𝑐4 and 𝑐3 so that 𝑦(0) = −100, 𝑦 & (0) = 0.
𝑦(0) = 𝑐4 = −100
\ 𝑐4 = −100, 𝑐3 = 25
𝑦 & (0) = A + 2𝑐3 = 0
3
The unique solution for this IVP is: 𝑦(𝑡) = 𝑒 B/3 (−100 cos 2𝑡 + 25 sin 2𝑡)
Inverse matrix
1 0 𝑐4 𝑦(0) 1 0 𝑐4 −100 𝑐4 4 2 0 −100 −100
or using matrices: E F G𝑐 H = E F à _4 ` G𝑐3 H = G H à G𝑐3 H = ∙ _ 4 `G H=G H
𝛼 𝛽 3 𝑦′(0) 3
2 0 3 − 3
1 0 25
1000 -2000
y'(t)
0
-3000
-1000 phase
IC
-2000
0 2 4 6 -4000
-2000 0 2000
Time in seconds y
The solution grows unbounded,
oscillating between ±∞.
5
Drexel University, College of Engineering 2017-2018 Academic Year
We can get a fuller picture of this system using pplane8. First recast the 2nd-order DE as a first-order system, making the standard
substitutions:
𝑦4 = 𝑦, 𝑦3 = 𝑦′
Thus:
𝑦3 0 1 𝑦
𝑑 𝑦4 (𝑡) 𝑦3 4
E F = G H = d 17 e = d 17 eG H
𝑑𝑡 𝑦3 (𝑡) 𝑦′′ − 𝑦4 + 𝑦3 − +1 𝑦3
4 4
6
Drexel University, College of Engineering 2017-2018 Academic Year
4. Now complete this table to solve and summarize four similar problems all at once! For each equation, use the same initial
conditions: 𝐈𝐂: 𝑦(0) = 1, 𝑦 & (0) = 2. In the column marked Roots & Stability, also state whether the DE is stable or unstable.
It is unstable, if any of the roots is positive, or if any complex root has a positive real part.
Differential Equation Characteristic Roots & Stability General Solution Solution of IVP
Equation (Write the root twice if 𝑦(0) = 1, 𝑦 & (0) = 2
𝑎𝑟 3 + 𝑏𝑟 + 𝑐 = 0 it is repeated.) (Same for all parts.)
Attempt all calculations by hand. Show details here. This will likely take several pages.
All the steps can be seen at a glance, except the calculation of the constants 𝑐4 and 𝑐3 .
From 𝑦(𝑡) = 𝑐4 𝑒 3B + 𝑐3 𝑒 aB , the derivative is: 𝑦′(𝑡) = 2𝑐4 𝑒 3B + 3𝑐3 𝑒 aB
From the initial condition, 𝑦(0) = 1 we must have: Eqn1: 1 = 𝑐4 + 𝑐3
From the initial condition, 𝑦′(0) = 2 we must have: Eqn2: 2 = 2𝑐4 + 3𝑐3
Subtracting twice equation 1 from equation 2 eliminates 𝑐4 and shows 𝑐3 = 0.
Therefore 𝑐4 = 1 and 𝑐3 = 0.
The solution satisfying this IVP is: 𝑦(𝑡) = 𝑒 3B
All the steps can be seen at a glance, except the calculation of the constants 𝑐4 and 𝑐3 .
From, 𝑦(𝑡) = 𝑐4 + 𝑐3 𝑒 D3B the derivative is: 𝑦 & (𝑡) = −2𝑐3 𝑒 D3B
From the initial condition, 𝑦(0) = 1 we must have: Eqn1: 1 = 𝑐4 + 𝑐3
From the initial condition, 𝑦′(0) = 2 we must have: Eqn2: 2 = −2𝑐3
Therefore 𝑐4 = 2 and 𝑐3 = −1.
The solution satisfying this IVP is: 𝑦(𝑡) = 2 − 𝑒 D3B
7
Drexel University, College of Engineering 2017-2018 Academic Year
All the steps can be seen at a glance, except the calculation of the constants 𝑐4 and 𝑐3 .
From 𝑦 = 𝑐4 𝑒 B cos 2𝑡 + 𝑐3 𝑒 B sin 2𝑡, the derivative is: 𝑦 & (𝑡) = 𝑒 B [ (𝑐4 + 2𝑐3 ) cos 2𝑡 + (−2𝑐4 + 𝑐3 ) sin 2𝑡 ]
We used the product and chain rules to find the above derivative.
All the steps can be seen at a glance, except the calculation of the constants 𝑐4 and 𝑐3 .
From, 𝑦 = 𝑐4 𝑒 DB cos 2𝑡 + 𝑐3 𝑒 DB sin 2𝑡 the derivative is: 𝑦 & (𝑡) = 𝑒 DB [ (−𝑐4 + 2𝑐3 ) cos 2𝑡 + (−2𝑐4 − 𝑐3 ) sin 2𝑡 ]
We used the product and chain rules to find the above derivative.
8
Drexel University, College of Engineering 2017-2018 Academic Year
5. Use MATLAB's dsolve command to find the exact solution for each problem. Complete the table to summarize your
work. These same equations reappear in the next problem. You do not have to solve these by hand this week, but you
should be able to on the next homework. Consider this a preview. These problems use different initial conditions.
b. 𝑦 && + 4𝑦 = 𝑡 3 + 3𝑒 B 7 19 𝑒 D3B 3 𝑡3 1
𝑦 (𝑡 ) = sin 2𝑡 − cos 2𝑡 − + 𝑒 B + −
𝑦(0) = 0, 𝑦′(0) = 2
10 40 2 5 4 8
c. 𝑦 && − 2𝑦 & + 𝑦 = 𝑡 𝑒 B + 4 𝑡a B
𝑦(0) = 1, 𝑦′(0) = 1 𝑦(𝑡) = −3𝑒 B + 4𝑡 𝑒 B + 𝑒 +4
6
Here is a block of MATLAB code that will help with the first one in the table.
%% 5a. Solve the DE exactly.
syms y(t)
a = 1; b = 1; c = -2;
Dy = diff(y,t); D2y = diff(y,t,t);
DE = a*D2y + b * Dy + c * y == 2*t
dsolve(DE, y(0)==0, Dy(0)==1)
Some examples look better after calling simplify. There are no hand calculations to show for this problem.
Just complete the above table.
9
Drexel University, College of Engineering 2017-2018 Academic Year
State Space Form: Consider the following second-order non-homogeneous differential equation.
Similar to the approach described in the Lab, we can convert the given 2nd-0rder DE to a 1st-order system by making the
lm
following substitutions. Let 𝑥4 = 𝑦 and let 𝑥3 = . Collect these two new variables into a column vector, which is
lB
called the state vector.
𝑥4
𝐱o⃗ = G𝑥 H
3
nd lqC lC m
Differentiating the state vector, and using the original 2 -0rder DE to eliminate = we find:
lB lB C
l 𝑥̇ 𝑥3 0 1 𝑥4 0
o⃗ = E 1 F = _s(B) \
𝐱 `=_ \ +E
− t G𝑥3 H F
u u`
lB 𝑥̇ 2 t
− t 𝑥4 − t 𝑥3 − t 𝐹(𝑡)/𝑎
Thus if we define:
0 1
0
𝐴 = E− 𝑐 −
𝑏 F and 𝐵 = G H and u = 𝐹(𝑡)/𝑎
1
𝑎 𝑎
𝑑
𝐱
o⃗ = 𝐴 𝐱
o⃗ + 𝑩 𝑢
𝑑𝑡
6. Complete the table below, to rewrite each of these 2nd-order non-homogeneous differential equations in the above
form. Give the matrix A, the column vector B and the scalar function u for each. Each 2nd-order system becomes
equivalent to the 1st-order system:
𝑑
The table can be 𝐱
o⃗ = 𝐴 𝐱
o⃗ + 𝑩 𝑢
completed by inspection. 𝑑𝑡 The first row has been done for you.
2nd-Order DE Matrix A Column Vector B Scalar u
a. 𝑦 && + 𝑦 & − 2𝑦 = 2𝑡 𝟎 𝟏 𝟎 𝒖 = 𝟐𝒕
𝑨=G H 𝑩=G H
𝑦(0) = 0, 𝑦′(0) = 1 𝟐 −𝟏 𝟏
b. 𝑦 && + 4𝑦 = 𝑡 3 + 3𝑒 B 𝟎 𝟏H 𝟎 𝑢 = 𝑡 3 + 3𝑒 B
𝑨=G 𝑩=G H
−𝟒 𝟎 𝟏
𝑦(0) = 0, 𝑦′(0) = 2
c. 𝑦 && − 2𝑦 & + 𝑦 = 𝑡 𝑒 B + 4 𝟎 𝟏H 𝟎 𝒖 = 𝑡 𝑒 B + 4
𝑨=G 𝑩=G H
𝑦(0) = 1, 𝑦′(0) = 1 −𝟏 𝟐 𝟏
10
Drexel University, College of Engineering 2017-2018 Academic Year
Attempt to solve each of the three differential equations from problem 6 qualitatively, using ode45. Using MATLAB,
create component plots and a phase plot for each equation. You could use code similar to Lab 4.
Component and Phase Plot for 6a. DE: 𝑦 && + 𝑦 & − 2𝑦 = 2𝑡 IC: 𝑦(0) = 0, 𝑦′(0) = 1
y Phase Plot
2.5 4
phase
IC
2 Equilibrium
3.5
1.5
y(t)
1 3
Note the solution is unstable
0.5 and marches off to infinity. The
2.5 "equilibrium" point, only
0 applies to the homogeneous
0 0.5 1 1.5
Time in seconds part of the DE.
dy/dt
Derivative of y
4
1.5
3.5
2.5 1
y'(t)
1.5 0.5
0.5 0
0 0.5 1 1.5 0 1 2 3
Time in seconds y
11
Drexel University, College of Engineering 2017-2018 Academic Year
Component and Phase Plot for 6b. DE: 𝑦 && + 4𝑦 = 𝑡 3 + 3𝑒 B IC: 𝑦(0) = 0, 𝑦′(0) = 2
Optional (Not graded)
y Phase Plot
14 15
12
10
8
y(t)
4
10 Note the solution is unstable
2
and marches off to infinity. The
0 "equilibrium" point, only
0 1 2 3
Time in seconds applies to the homogeneous
dy/dt
10
y'(t)
2 0
0 1 2 3 0 5 10 15
Time in seconds y
12
Drexel University, College of Engineering 2017-2018 Academic Year
Component and Phase Plot for 6c. DE: 𝑦 && − 2𝑦 & + 𝑦 = 𝑡 𝑒 B + 4 IC: 𝑦(0) = 1, 𝑦′(0) = 1
Optional (Not graded)
y Phase Plot
8 16
6 14
5
y(t)
4
12
2
10
1
0 0.5 1 Note the solution is unstable
Time in seconds and marches off to infinity. The
dy/dt
8
"equilibrium" point, only
phase
Derivative of y
IC applies to the homogeneous
Equilibrium
16
part of the DE.
14 6
12
10
4
y'(t)
6
2
4
0 0
0 0.5 1 0 2 4 6 8
Time in seconds y
13
Drexel University, College of Engineering 2017-2018 Academic Year
Appendix: Component and phase plots for the four homogeneous second-order DE's in Question 4.
Just for insight. Not required.
y Phase Plot
8 15
5
y(t)
2
10
Notice the solution does not
1 approach the equilibrium
0 0.5 1
Time in seconds value at y = 0, but instead
dy/dt
phase marches off towards infinity.
Derivative of y IC
16 Equilibrium
14 Unstable!
5
12
10
y'(t)
2 0
0 0.5 1 0 2 4 6 8
Time in seconds y
y Phase Plot
2 2
1.8
1.8
1.6 phase
IC
1.6
y(t)
Equilibrium
1.4
1.4
Phase plot is a straight line,
&&
DE #4b: 𝑦 + 2𝑦′ = 0
1.2 for all initial conditions, for this
1
1.2 particular DE.
0 2 4 6
Time in seconds Stable!
dy/dt
1
Derivative of y
2
0.8 Stable!
1.5
0.6
y'(t)
1 0.4
0.5 0.2
0 0
0 2 4 6 0 0.5 1 1.5 2
Time in seconds y
14
Drexel University, College of Engineering 2017-2018 Academic Year
y Phase Plot
2 25
20
-2 phase
IC
y(t)
Equilibrium
-4
15
-6 Phase plot marches off towards
DE #4c: 𝑦 && − 2 𝑦 & + 5𝑦 = 0 infinity.
-8 10
0 0.5 1 1.5 2 2.5
Time in seconds Unstable!
dy/dt
Derivative of y 5
25
20
15
0
10
y'(t)
5
-5
0
-5
-10 -10
0 0.5 1 1.5 2 2.5 -8 -6 -4 -2 0 2
Time in seconds y
y Phase Plot
1.5 2
phase
IC
Equilibrium
1
1.5
y(t)
0.5
1
DE #4d: 𝑦 && + 2 𝑦 & + 5𝑦 = 0
0
Derivative of y
2
1.5 -0.5
0.5 -1
y'(t)
-0.5
-1.5
-1
-1.5
-2 -2
0 1 2 3 4 5 -0.5 0 0.5 1 1.5
Time in seconds y
15