You are on page 1of 5

DIGITAL ASSIGNMENT-2

Name: Havila Reddy


Register No: 19BCT0211

Question 1:
1. Aim of the experiment:

Aim of this experiment is using matlab to find characteristic polynomial, eigen values
and eigen vectors of a given matrix.

2. Mathematical Procedure:

1. For a square matrix A of order n, characteristic equation is found by solving


|A- λI|=0.
2. The values of λ after solving are called eigen values of matrix A.
3. The solution of X for AX= Λx are called eigen vectors.
4. Eigen values of transpose matrix of A are same as eigen values of A.

3. Matlab Code:

clc
clear all
A=input("Enter the Matrix: ");
ce=poly(A);
disp("Characteristic Equations")
disp(ce)
disp("roots:")
variable=roots(ce)
EV=eig(A);
disp("Eigenvalues")
disp(EV)
[P D]=eig(A);
disp("Eigenvectors")
disp(P)
EVI=eig(inv(A));
disp("Eigenvalues of inv(A)")
disp(EVI)
EVT=eig(A');
disp("Eigenvalues of transpose of A")
disp(EVT)
B=2*(A^2)-5*A+4*eye(3);
EVB=eig(B);
disp("Eigenvalues of B")
disp(EVB)
4. Input:

Enter the Matrix:


[2 -1 1;-1 2 -1;1 -1 2]

Output:
Characteristic Equations
1.0000 -6.0000 9.0000 -4.0000

roots:
variable =

4.0000
1.0000
1.0000

Eigenvalues
1.0000
1.0000
4.0000

Eigenvectors
0.4082 0.7071 -0.5774
-0.4082 0.7071 0.5774
-0.8165 0 -0.5774

Eigenvalues of inv(A)
0.2500
1.0000
1.0000

Eigenvalues of transpose of A
1.0000
1.0000
4.0000

Eigenvalues of B
1.0000
1.0000
16.0000

5. Conclusion:
Characteristic Equation, eigen values and eigen vectors of a matrix can be found
easily using matlab.

Question 2:

1. Aim of the experiment:

Aim of this experiment is to verify Caley-Hamilton Theorem and find inverse of a


matrix using this theorem.

2. Mathematical Procedure:

According to Caley-Hamilton theorem, it is known that every square matrix


satisfies it’s characteristic Equation. Using this theorem, inverse of the matrix is
also found.

3. Matlab Code:

clc
clear
A=input("Enter the Matrix:");
cf=poly(A);
n=length(cf);
CHT=cf(1)*A^(n-1);
for i=2:n
CHT=CHT+cf(i)*A^(n-i);
end
disp("R.H.S of C-H Theorem: ")
disp(round(CHT))
INV=cf(1)*A^(n-2);
for i=2:n-1
INV=INV+cf(i)*A^(n-i-1);
end
INV=INV/(-cf(n));
disp("Inverse of A: ")
disp(INV)

4. Input:

Enter the Matrix:


[7 2 -2;-6 -1 2;6 2 -1]

Output:

R.H.S of C-H Theorem:


0 0 0
0 0 0
0 0 0

Inverse of A:
-1.0000 -0.6667 0.6667
2.0000 1.6667 -0.6667
-2.0000 -0.6667 1.6667

5. Conclusion:

By this experiment, Caley-Hamilton theorem is verified and inverse of a matrix


can be found without having to calculate adjoint of the matrix.

Question 3:

1. Aim of the experiment:

Aim of this experiment is to find modal matrix of the given matrix and using which
normalised modal matrix and diagonal matrix can be found.

2. Mathematical Procedure:

For any real symmetric matrix A, there exists a modal matrix P using a normalised
matrix N which is formed by normalised eigen vectors.
P=NA(inv(N))

Canocial form can easily be witten in form of symmetric matrix manually,by eigen
Values in it’s diagonal.

3. Matlab Code:

clc
clear
A=input("Enter the symetric matrix for diagonalization :");
[P D]=eig(A);
disp("Given Matrix (A) :")
disp(A)
disp("Modal Matrix (P):")
disp(P)
NP=normc(P);
disp("Normalized Modal Matrix (N):")
disp(NP)
disp("Diagonal Matrix (D=Nˆ T*A*N) :")
DM=round(NP'*A*NP,2);
disp(DM)

4. Input:
Enter the symetric matrix for diagonalization :
[3 -1 -1;-1 5 -1;-1 -1 3]

Output:

Given Matrix (A) :


3 -1 -1
-1 5 -1
-1 -1 3

Modal Matrix (P):


-0.6572 -0.7071 0.2610
-0.3690 -0.0000 -0.9294
-0.6572 0.7071 0.2610

Normalized Modal Matrix (N):


-0.6572 -0.7071 0.2610
-0.3690 -0.0000 -0.9294
-0.6572 0.7071 0.2610

Diagonal Matrix (D=Nˆ T*A*N) :


1.4400 0 0
0 4.0000 0
0 0 5.5600

5. Conclusion:

By this experiment, we know that modal matrix and normalised matrix can be easily
found using matlab.

You might also like