You are on page 1of 2

clear all clc m=45; kx=2000 ; ky=8000 ;cx=40 ;cy=100 ; dy=1; r=0.

30; I=(m-dy)*(r^2); M=[m 0 0 0 m 0 0 0 I]; K=[2*kx 0 -(3^(1/2))*r*kx 0 2*ky 0 -(3^(1/2))*r*kx 0 -(r^2)*(3*kx+ky)/(2*I)]; A=K/M; %% Calculating the Polinomial coefficients of the Det(A-Lambda*I) syms l %Lambda's are symbolic to calculate the determinant of eig. matrix C=A-l*eye(size(A)); d=det(C); coeff=sym2poly(d); %Translates the symbolic formula of the determinant to polyn omial coefficients. %% Finding the Eigenvalues with Newton-Rhapson Method F=coeff; n=length(F)-1; %handling the degree of Characteristic Equation f=zeros(1,n); %preparing the derivative polinomial coefficient vector. for i=1:n f(i)=F(i)*(n+1-i); end plot(-100:1:400,polyval(F,-100:1:400));grid on %3 roots are expected, and from the plot initial guesses can be made. title('Characteristic Equation');xlabel('Lambda');ylabel('F'); %% The Newton-Rhapson Algorithm L=zeros(n,1); x0=[-80 150 350]'; %Initial guesses e=1; while e>10^-8; x=x0-polyval(F,x0)./polyval(f,x0); e=abs(x-x0); x0=x; end L=x0; %Eigenvalues! if Trace(A)==sum(L); % Checking if the sum of the Eigenvalues matches with the t r(A). disp('Eigenvalues are Correct! (Checked with Trace of Matrix A)') else disp('Eigenvalues are not matched with Traceof Matrix A') end %% Power Method to find the Eigenvectors v(:,1)=[1 1 1]'; for i=1:50 V=A*v(:,1); v(:,1)=V/(max(abs(V))); end v(:,2)=[1 0 1]'; for i=1:50

V=A*v(:,2); v(:,2)=V/(max(abs(V))); end %% End

You might also like