Page 90 - MATLAB an introduction with applications
P. 90
MATLAB Basics ——— 75
x =
8/5+ (–3/10–1/290*29^ (1/2))*exp (1/2*(–7+29^ (1/2))*t)–1/290*
(–1+3*29^ (1/2))*29^ (1/2)*exp(–1/2*(7+29^ (1/2))*t)
Example E1.27: Given the differential equation
2
dx dx
+ 12 + 15 = 35 ; t ≥ 0
x
dt 2 dt
Using MATLAB program, find
(a) x(t) when all the initial conditions are zero.
(b) x(t) when x (0) = 0 and x (0) = 1.
Solution:
(a) x (t) when all the initial conditions are zero
>> x = dsolve (‘D2x = –12*Dx – 15*x +35’, ‘x (0) = 0’)
x =
7/3+ (–7/3–C2)*exp ((–6+21^ (1/2))*t) +C2*exp (–(6+21^ (1/2))*t)
(b) x (t) when x (0) = 0 and x (0)= 1.
>> x = dsolve (‘D2x = –12*Dx – 15*x + 35’, ‘x (0) = 0’, ‘Dx (0) = 1’)
x =
7/3+ (–7/6–13/42*21^ (1/2))*exp ((–6+21^ (1/2))*t)–1/126*(39+7*21^
(1/2))*21^ (1/2)*exp (–(6+21^ (1/2))*t)
Example E1.28: Find the inverse of the following matrix using MATLAB.
s 2 0
A = 2 s –3
30 1
Solution:
>> A = [s 2 0; 2 s –3; 3 0 1];
>> inv (A)
ans =
[s/(s^2–22), –2/(s^2–22), –6/(s^2–22)]
[–11/(s^2–22), s/(s^2–22), 3*s/(s^2–22)]
[–3*s/(s^2–22), 6/(s^2–22), (s^2–4)/(s^2–22)]
Example E1.29: Expand the following function F(s) into partial fractions using MATLAB. Determine the
1
inverse Laplace transform of F(s) = .
3
s 4 +5 +7s 2
s
F:\Final Book\Sanjay\IIIrd Printout\Dt. 10-03-09