Page 37 - MATLAB an introduction with applications
P. 37
22 ——— MATLAB: An Introduction with Applications
lamda = eig(A)
lamda = 0.5949
3.0000
8.4051
[V, D] = eig (A)
V =
–0.6713 0.9163 –0.3905
0.6713 –0.3984 0.3905
–0.3144 0.0398 0.8337
D =
0.5949 0 0
0 3.0000 0
0 0 8.4051
Example E1.3: Determine the values of x, y and z for the following set of linear algebraic equations:
x – 3x = –5
2
3
2x + 3x – x = 7
1
2
3
4x + 5x – 2x = 10
3
2
1
Solution:
Here
0 1 − 3 5 x
1
A = 2 3 −1 , B = 7 and X = x 2
4 5 − 2 10 x
3
AX = B
–1
–1
A AX = A B
IX = A B
–1
–1
or X = A B
>> A = [0 1 –3; 2 3 –1; 4 5 –2];
>> B = [–5; 7; 10]
>> x = inv (A)*B
x =
–1.0000
4.0000
3.0000
>> check = A*x
check =
–5
7
10
% Alternative method
>> x = A\B
x =
–1
4
3
F:\Final Book\Sanjay\IIIrd Printout\Dt. 10-03-09