You are on page 1of 5

MECHANICAL VIBRATIONS

(DE G611)

Assignment

SUBMITTED

TO
DR.SANDEEP JOSE

SUBMITTED BY
MANEPALLI RAVI TEJA (2017H1410057G)

BIRLA INSTITUTE OF TECHNOLOGY AND SCIENCE,

K. K. BIRLA, GOA CAMPUS


1)Develop a general program, to implement Jacobi’s method to find the eigenvalues and

eigenvectors of a symmetric matrix. Use the program to find the eigenvalues and
eigenvectors of the matrix

1 1 1 
 
1 2 2 
1 2 3 
 

Jacobian code:

rows=input('please enter number of rows of square matrix');

A=zeros(rows,rows);

C=zeros(rows,rows);

D=zeros(rows,rows);

V=eye(rows,rows);

N=inf;

for i=1:rows

for j=1:rows

A(i,j)=input('Enter the A elements');

end

end

B= A-diag(diag(A));

[M,I] = max(B(:));

[X,Y] = ind2sub(size(B),I);

while N >0.001

D=eye(rows);

t= 0.5*(atan(2*A(X,Y)/(A(X,X)-A(Y,Y))));

D(X,X)=cos(t);D(X,Y)=sin(t);D(Y,X)=-sin(t);D(Y,Y)=cos(t);
A=D'*A*D;

V=V*D;

C= A-diag(diag(A));

N = max(max(C));

[M,I] = max(C(:));

[X,Y] = ind2sub(size(C),I);

End

o=diag(A);

fprintf('The eigen values are \n');

fprintf('The respective eigen vector is \n');

Output:

V=

0.3281 -0.5830 -0.7433

0.5910 0.7405 -0.3199

0.7369 -0.3343 0.5875

2)Develop a general computer program, , to implement the matrix iteration method. Use
the program to find the eigenvalues and eigenvectors of the matrix [A] given in Q1
Matrix iterative method:
Code:

rows=input('please enter number of rows of square matrix');

A=eye(rows,rows);

for i=1:rows

for j=1:rows

D(i,j)=input('Enter the elements of D');

end
end

X=[1;1;1];

for i=1:rows

for j=1:8

x= D*X;

X= (1/x(1,1))*x;

end

c= X'*A*X;

w= (1/c)^(1/2);

fprintf('No.%d eigen value is %d\n',i,x(1,1));

fprintf('The respective eigen vector is \n');

X= w*X;

D= D - (x(1,1)*X*X'*A);

end

Output:

No.1 eigen value is 5.048916e+00

The respective eigen vector is

X = 0.3280

0.5910

0.7370

No.2 eigen value is 6.431004e-01

The respective eigen vector is

X = 0.7370

0.3280

-0.5910
No.3 eigen value is 3.079785e-01

The respective eigen vector is

X = 0.5910

-0.7370

0.3280

>>

You might also like