10/4/22 12:07 AM D:\Mode_Shapes.
m 1 of 1
fprintf('This Program Calculates The Modal Properties Of A Structure \n \n')
% Given Data : K = Stiffness Matrix, M = Mass Matrix
K = [20728960,-10364480,0;-10364480,20728960,-10364480;0,-10364480,10364480];
M = [2022,0,0;0,2427,0;0,0,2427];
fprintf('The Mass Matrix is as follows \n')
disp(M)
fprintf('The Stiffness Matrix is as follows \n')
disp(K)
% Eigen Value And Vector Calculation
[v,d] = eig(K,M);
w = sqrt(d);
% Natural Frequency And Time Period
fprintf('The natural frequencies of this structure are as follows (rad/sec) \n')
w1 = w(1,1);
w2 = w(2,2);
w3 = w(3,3);
disp([w1;w2;w3])
fprintf('The natural time periods of this structure are as follows (sec) \n')
t1 = (2*3.14)/w(1,1);
t2 = (2*3.14)/w(2,2);
t3 = (2*3.14)/w(3,3);
disp([t1;t2;t3])
% Normalization of Mode Shape Vectors
for i=1:3
v(:,i)=v(:,i)/v(3,i);
end
% Modal Shape Matrix
fprintf('The normalized modal matrix of this structure is as follows \n')
disp(v);
% Individual Mode Shape Vector
% fprintf('Individual Mode Shapes')
% mode 1 = v(:,1)
% mode 2 = v(:,2)
% mode 3 = v(:,3)
% Plotting Of Mode Shapes
Height = [0;3;6;9];
for i = 1:3
subplot (1,3,i)
plot([0;v(:,i)], Height);
ylabel('Height Of The Structure (m)','FontSize',12);
title(['Mode Shape', num2str(i)],'FontSize',18)
end
MATLAB Command Window Page 1
Warning: MATLAB has disabled some advanced graphics rendering features by switching
to software OpenGL. For more information, click here.
>> Mode_Shapes
This Program Calculates The Modal Properties Of A Structure
The Mass Matrix is as follows
2022 0 0
0 2427 0
0 0 2427
The Stiffness Matrix is as follows
20728960 -10364480 0
-10364480 20728960 -10364480
0 -10364480 10364480
The natural frequencies of this structure are as follows (rad/sec)
29.3431
85.2746
122.1901
The natural time periods of this structure are as follows (sec)
0.2140
0.0736
0.0514
The normalized modal matrix of this structure is as follows
0.4358 -1.2089 2.7347
0.7984 -0.7028 -2.4962
1.0000 1.0000 1.0000
>>