Lab Da 1
Lab Da 1
MATLAB OUTPUT:
Enter the Matrix:[1 4;2 3]
R.H.S of C-H Theorem:
0 0
0 0
inverse exists
Inverse of A:
-0.6000 0
-0.4000 -0.2000
Problem 2: Diagonalize a matrix A by similarity transformation
and hence find 𝐴 𝑛 (n=9).
clc
clear all
A=input('Enter the matrix for diagonalization :');
[P D]=eig(A);
disp('Given Matrix (A) :')
disp(A)
disp('Modal Matrix (P):')
disp(P)
disp('Inverse of P :')
PI=inv(P);
disp(PI)
disp('Diagonal Matrix (D=Pˆ(-1)*A*P):')
DM=round(inv(P)*A*P, 2);
disp(DM)
n=input('enter the power:');
Apown=P*(DM.^n)*inv(P);
disp(Apown)
MATLAB OUTPUT:
Enter the matrix for diagonalization :[2 2 -7; 2 1 2; 0 1 -3]
2 2 -7
2 1 2
0 1 -3
Inverse of P :
3 0 0
0 1 0
0 0 -4
1.0e+05 *
clc
clear all
A=input('Enter the symmetric matrix for diagonalisation:');
[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)
n=input('enter the power:');
Apown=NP*(DM.^n)*inv(NP);
disp(Apown)
MATLAB OUTPUT:
MATLAB OUTPUT:
Enter the symmetric matrix for diagonalisation:[1 -1 3; -1 5 6;
3 6 7]
Given Matrix (A) :
1 -1 3
-1 5 6
3 6 7
Modal Matrix (P) :
0.6450 0.7492 0.1510
0.5331 -0.5826 0.6135
-0.5476 0.3152 0.7751
Normalized Modal Matrix (N):
0.6450 0.7492 0.1510
0.5331 -0.5826 0.6135
-0.5476 0.3152 0.7751
Diagonal Matrix (D=N^T*A*N):
-2.3700 0 0
0 3.0400 0
0 0 12.3300
enter the power:8
1.0e+08 *
0.1219 0.4950 0.6254
0.4950 2.0109 2.5403
0.6254 2.5403 3.2093