FEM Beam problem

版本 1.0.0.0 (2.1 KB) 作者: Sajeer Modavan
This code may help you to calculate the displacement and support reactions of Beam using FEM
1.6K 次下载
更新时间 2015/12/1

查看许可证

% This Matlab code help you to calculate the displacements and reactions of
% Beam. You may Need to change the boundary conditions for different cases
% of Beam. If you are changing the number of elements, you may need to
% change the force vectors (F_udl & F_pl) in line 16 and 17.
clc; clear; close all;

L = 1; % Length in m
E = 2.1*10^8; % Modulus of Elasticity KN/m2
I = 2120/100^4; % Moment of Inertia m4
w = 1000; % Uniformly Distributed Load kN/m
wp = 1000; % Concentrated Load kN

BC = [1 2 5]; % Boundary Condition

F_udl = w*[-L/2;(L^2)/48-(L^2/48);(L^2/48)];
F_pl = wp*[-1;-0.05;0];

Ne = input('Type Number of element or press "Enter" to use default 2 Element ');
if (isempty(Ne))
Ne = 2;
else
end

Ndof = 2*(Ne+1);
Dof = 1:1:Ndof;

le = L/Ne;

% Compute the stiffness matrix for the structure
Kj = zeros(4,4);
Kj(1,1) = 6;
Kj(1,2) = 3*le;
Kj(1,3) = -6;
Kj(1,4) = 3*le;
Kj(2,2) = 2*le^2;
Kj(2,3) = -3*le;
Kj(2,4) = le^2;
Kj(3,3) = 6;
Kj(3,4) = -3*le;
Kj(4,4) = 2*le^2;

for ii = 2:4,
for jj = 1:ii,
Kj(ii,jj) = Kj(jj,ii);
end
end
Ke = (2*E*I/le^3).*Kj;

KG = zeros(Ndof,Ndof);
for ii = 1:Ne
aa = 2*ii-1;
KG(aa:aa+3,aa:aa+3) = KG(aa:aa+3,aa:aa+3)+Ke;
end

K_temp = KG;
for jj = 1:length(BC)
K_temp(:,BC(jj)) = 0;
K_temp(BC(jj),:) = 0;
end
K_temp(~any(K_temp,2),:) = [];
K_temp(:,~any(K_temp,1)) = [];
KR = K_temp;

FR = F_udl+F_pl;

UR = KR\FR;
UG = [0 0 UR(1) UR(2) 0 UR(3)]';
Rc = KG*(UG);

clc
disp('Displacement in mm & rad')
UR = [UR(1)*1000;UR(2);UR(3)];
disp(UR)
disp('Reaction in kN')
Reaction = [Rc(1)+w*L/4; Rc(2)+w*(L/2)^2/12; Rc(5)+w*L/4];
disp(Reaction)

引用格式

Sajeer Modavan (2024). FEM Beam problem (https://www.mathworks.com/matlabcentral/fileexchange/54257-fem-beam-problem), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2007a
兼容任何版本
平台兼容性
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0