You are on page 1of 6

% Program to generate natural frequency for Medium Carbon Steel

% both using Finite element method and Euler's method for different
% boundary conditions

clear all
clc
disp('Cantilever beam Medium Carbon Steel of dimension');
disp('0.40 X 0.0028 X 0.004 m');
disp('Elastic Modules E = 210 GPa');
disp('Density = 7800 kg/cu.m');

E = 2.1e11;
d = 7800;
L = 1;
b = 0.05;
t = 0.005;

display('Number of element ')


Noe = 10;
l = L/Noe;

r = d*b*t;
l = L/Noe;
A = b*t;
m = d*A;
I = b*t^3/12;
%------------------ Stiffness and Mass Matrix ----------------------------% Stiffness matrix
K1 = zeros(2*(Noe+1),2*(Noe+1));
k11 = [12 6*l;6*l 4*l^2];
k12 = [-12 6*l;-6*l 2*l^2];

k21 = [-12 -6*l;6*l 2*l^2];


k22 = [12 -6*l;-6*l 4*l^2];
K1(1:2,1:2)=k11;
K1(2*Noe+1:2*(Noe+1),2*Noe+1:2*(Noe+1))=k22;

for n = 1:Noe-1
K1(2*n+1:2*n+2,2*n-1:2*n)=k21;
K1(2*n+1:2*n+2,2*n+1:2*n+2)=k11+k22;
K1(2*n-1:2*n,2*n+1:2*n+2)=k12;

end

K1(2*Noe-1:2*Noe,2*Noe+1:2*(Noe+1))= k12;
K1(2*Noe+1:2*(Noe+1),2*Noe-1:2*Noe)= k21;
% Mass matrix
M1 = zeros(2*(Noe+1),2*(Noe+1));
m11 = [156 22*l;22*l 4*l^2];
m12 = [54 -13*l;13*l -3*l^2];
m21 = [54 13*l;-13*l -3*l^2];
m22 = [156 -22*l;-22*l 4*l^2];
M1(1:2,1:2) = m11;
M1(2*Noe+1:2*(Noe+1),2*Noe+1:2*(Noe+1)) = m22;
for n = 1:Noe-1
M1(2*n+1:2*n+2,2*n-1:2*n) = m21;
M1(2*n+1:2*n+2,2*n+1:2*n+2) = m11+m22;
M1(2*n-1:2*n,2*n+1:2*n+2) = m12;

end
M1(2*Noe-1:2*Noe,2*Noe+1:2*(Noe+1))= m12;
M1(2*Noe+1:2*(Noe+1),2*Noe-1:2*Noe)= m21;
Kx = (E*I/(l^3))*K1;

Mx = (m*l/420)*M1;
KGb = Kx;
MGb = Mx;
% ------------------ Applying Boundary condition --------------------------

% ------------------ Cantilever Beam -------------------------------------KGb(1:2,:) = [];


KGb(:,1:2) = [];
MGb(1:2,:) = [];
MGb(:,1:2) = [];

[phib,lamb] = eig(KGb,MGb); % KGb & MGb are stiffness and mass matrix of bare beam
Kmb = phib' * KGb * phib;

% ---------------------------- END of Case 1 -----------------------------K = KGb;


M = MGb;
% Display Result
[phi,lam] = eig(K,M);
w = sqrt(lam)*(2*pi)^-1;% in Hz

Wn1 = w(1,1);
Wn2 = w(2,2);
Wn3 = w(3,3);
%----------------------Eulers method-CANTILEVER BEAM---------------------root = sqrt((E*I)/(r*(L^4)));
w1 = 3.52 *(root)*(2*pi)^-1;
w2 = 22.0 *(root)*(2*pi)^-1;
w3 = 61.7 *(root)*(2*pi)^-1;

disp('Finite Element Method & Eulers method- Cantilever beam')

disp('Frequenmcies in Hz')

res(1,1) = Wn1;
res(2,1) = Wn2;
res(3,1) = Wn3;

res(1,2) = w1;
res(2,2) = w2;
res(3,2) = w3;

res

% 2Dof free vibration without damping


clear all
m1=5;
m2=10;
k1=15;
k2=20;
M=[m1 0 ;0 m2];
K=[k1+k2 -k2;-k2 k2];
A=M*K^-1;
D=eig(A);
omega=[1/sqrt(D(1)); 1/sqrt(D(2))]

%1degree of freedom
clear
m1=5;

k1=15;
M=[m1];
K=[k1];
A=M*K^-1;
D=eig(A);
omega=[1/sqrt(D(1))]

% 3Dof free vibration without damping


clear all
clc
% Masses and Mass matrix
m1 = 10;
m2 = 12;
m3 = 5;
M=[m1 0 0;0 m2 0;0 0 m3];

% Stiffness and stifness matrix


k1 = 12;
k2 = 20;
k3 = 15;
K=[k1+k2 -k2 0;-k2 k2+k3 -k3;0 -k3 k3];

% W = (sqrt(inv(K*M))

Lamda = eig(K,M);

disp('Frequency in rad/sec')
w = sqrt(Lamda);% in rad/sec

w1 = w(1)
w2 = w(2)
w3 = w(3)

disp('Frequency in Hz')
w = sqrt(Lamda)*(2*pi)^-1;% in Hz
w1 = w(1)
w2 = w(2)
w3 = w(3)

You might also like