question archive Can you please find the error in the matlab code below? It generates natural frequencies correctly, but there is an error in modal shapes

Can you please find the error in the matlab code below? It generates natural frequencies correctly, but there is an error in modal shapes

Subject:MathPrice: Bought3

Can you please find the error in the matlab code below? It generates natural frequencies correctly, but there is an error in modal shapes.

modal shapes vector's answer = [1,1,1; 0.647, -0.601, -2.584; 0.301, -0.676.2.484] (You can check according to this answer.)

% program to get normalized vectors and eigen values

clc;

close all;

m=[1 0 0;0 1.5 0;0 0 2];

disp(' mass matrix')

m

%you can give stiffness matrix

% disp(' stiffness matrix')

k=[600 -600 0;-600 1800 -1200;0 -1200 3000];

% k

% a=inv(k);

% or you can given flexibility matrix directly

a=[.75 .5 .25;.5 1 .5;.25 .5 .75];

disp(' flexibility matrix')

a

c=a*m;

[ms,ns]=size(m);

%eigen values and eigen vectors

[V,D]=eig(k,m);

for i=1:ms

e(i)=1/D(i,i);

end

Qh=max(e)+0.001;

Ql=0;

for i=1:ms

for j=1:ms

if e(j) > Ql && e(j) < Qh

kk=j;

Qh=e(j);

else

end

end

Ql=Qh;

Qh=max(e)+0.001;

om1(i)=e(kk);

omega(i)=1/sqrt(e(kk));

for l=1:ms

p1(l,i)=V(l,kk);

end

end

%Normalizing the mode shape

L=p1'*m*p1;

L1=p1'*k*p1;

%develop modal matrix

for i=1:ms

for j=1:ms

p(i,j)=p1(i,j)/sqrt(L(j,j));

end

end

disp(' Natural frequencies in rad/sec')

disp(omega)

disp(' normalized modal vector')

disp(p)

p'*m*p

p'*k*p

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE