Use matlab to solve the whole wuestion please I need the cod


Use matlab to solve the whole wuestion please. I need the code part for this problem!
2. Compute the matrix product AB for the following cases. Also find the matrix product BA, if it exists. Also, if the product AB or BA is square, find its eigenvalues and eigenvectors. Compute these by hand but you may use MATLAB to verify your solutions 1 2 (a) A=13 3 4 (b) A = | 21, B=[1 2-1] 4 0 1 11 2 (c) A=[1 2-1], B=12 (d) A = 12 01, B= 0-1 11 [o 1 (e) A=12 0 1 1, B=12 0 1 1 -1

Solution

Type following code in command window or script file

>> A=[1 2;3 4]

A =

1 2
3 4

>> B=[1 2;3 4]

B =

1 2
3 4

>> A*B

ans =

7 10
15 22

>> B*A

ans =

7 10
15 22

>> eig(A*B)

ans =

0.1386
28.8614

>> [V,D]=eig(A*B)

V =

-0.8246 -0.4160
0.5658 -0.9094


D =

0.1386 0
0 28.8614

---------------------------------------------------------------------------

e = eig(A) returns a column vector containing the eigenvalues of square matrix A.

example

[V,D] = eig(A) returns diagonal matrix D of eigenvalues and matrix V whose columns are the corresponding right eigenvectors, so that A*V = V*D.

-----------------------------------------------------------------------------------------------

b)

>> A=[1;2;3]

A =

1
2
3

>> B=[1 2 -1]

B =

1 2 -1

>> A*B

ans =

1 2 -1
2 4 -2
3 6 -3

>> B*A

ans =

2

>> eig(A*B)

ans =

2.0000
-0.0000
-0.0000

>> eig(B*A)

ans =

2

>> [V,D]=eig(B*A)

V =

1


D =

2

>> [V,D]=eig(A*B)

V =

-0.2673 0.2458 0.7461
-0.5345 0.3324 -0.5561
-0.8018 0.9106 -0.3661


D =

2.0000 0 0
0 -0.0000 0
0 0 -0.0000

---------------------------------------------------------------------------------------------------------

c)

A=[1 2 -1]

A =

1 2 -1

>> B=[1;2;3]

B =

1
2
3

>> A*B

ans =

2

>> eig(B*A)

ans =

2.0000
-0.0000
-0.0000

>> B*A

ans =

1 2 -1
2 4 -2
3 6 -3

>> eig(A*B)

ans =

2

>> eig(B*A)

ans =

2.0000
-0.0000
-0.0000

>> [V,D]=eig(B*A)

V =

-0.2673 0.2458 0.7461
-0.5345 0.3324 -0.5561
-0.8018 0.9106 -0.3661


D =

2.0000 0 0
0 -0.0000 0
0 0 -0.0000

>> [V,D]=eig(A*B)

V =

1


D =

2

-------------------------------------------------------------------------

d)

>> A=[0 1;2 0;1 1]

A =

0 1
2 0
1 1

>> B=[1 2;3 4]

B =

1 2
3 4

>> A*B

ans =

3 4
2 4
4 6

----------------------------------------------------------------------

e)

>> A=[0 -1 1;2 0 1;1 1 -1]

A =

0 -1 1
2 0 1
1 1 -1

>> B=[0 1;2 0;1 1]

B =

0 1
2 0
1 1

>> A*B

ans =

-1 1
1 3
1 0

 Use matlab to solve the whole wuestion please. I need the code part for this problem! 2. Compute the matrix product AB for the following cases. Also find the m
 Use matlab to solve the whole wuestion please. I need the code part for this problem! 2. Compute the matrix product AB for the following cases. Also find the m
 Use matlab to solve the whole wuestion please. I need the code part for this problem! 2. Compute the matrix product AB for the following cases. Also find the m
 Use matlab to solve the whole wuestion please. I need the code part for this problem! 2. Compute the matrix product AB for the following cases. Also find the m
 Use matlab to solve the whole wuestion please. I need the code part for this problem! 2. Compute the matrix product AB for the following cases. Also find the m

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site