Page 211 - Numerical Analysis Using MATLAB and Excel
P. 211
Chapter 5 Differential Equations, State Variables, and State Equations
We will use MATLAB to find the first and second derivatives of this expression.
syms t k3 % Define symbolic variables
y0=k3*t*exp(−t); % Assumed form of total solution
y1=diff(y0); f1=simple(y1) % Compute and simplify first derivative
f1 =
-k3*exp(-t)*(-1+t)
Thus, the first derivative of y F is
t –
dy ⁄ dt = k e – k te t –
3
F
3
y2=diff(y0,2); f2=simple(y2) % Compute and simplify second derivative
f2 =
k3*exp(-t)*(-2+t)
and the second derivative of is
y
2
2
t –
d y ⁄ dt = – 2k e + k te t –
3
3
F
f=y2+4*y1+3*y0; f=simple(f) % Form and simplify the left side of the given ODE
f =
2*k3/exp(t)
and by substitution into the given ODE
2k e t – = 4e t –
3
or k = 2 . Therefore,
3
t –
y = k e + k e – 3t + 2te t –
2
1
Check with MATLAB:
y=dsolve('D2y+4*Dy+3*y=4*exp(−t)'); y=simple(y)
2*t/exp(t)-1/exp(t)+C1/exp(t)+C2/exp(t)^3
We observe that the second and third terms of the displayed expression above have the same
form and thus they can be combined to form a single term C3/exp(t).
3. The characteristic equation yields two equal roots s = s = – 1 and thus the natural response
2
1
has the form
t –
y N = k e + k te t –
2
1
For the forced response we assume a solution of the form
y = k cos 2t + k sin 2t + k 5
3
4
F
5−50 Numerical Analysis Using MATLAB® and Excel®, Third Edition
Copyright © Orchard Publications