100% found this document useful (1 vote)
230 views6 pages

MATLAB Code For Drawing SF, BM, Slope and Deflection Diagrams

This MATLAB code generates shear force, bending moment, slope, and deflection diagrams for a simply supported beam under a uniformly distributed load. The code defines the beam properties and loads as inputs. It then calculates the reactions, bending moment, shear force, slope, and deflection as functions of position along the beam. Finally, it outputs the diagrams and finds the locations and values of maximum bending moment and maximum deflection.

Uploaded by

ashoku24007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
230 views6 pages

MATLAB Code For Drawing SF, BM, Slope and Deflection Diagrams

This MATLAB code generates shear force, bending moment, slope, and deflection diagrams for a simply supported beam under a uniformly distributed load. The code defines the beam properties and loads as inputs. It then calculates the reactions, bending moment, shear force, slope, and deflection as functions of position along the beam. Finally, it outputs the diagrams and finds the locations and values of maximum bending moment and maximum deflection.

Uploaded by

ashoku24007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

MATLAB Code for drawing SF,BM,slope and deflection diagrams :

𝑤𝐿
𝑅𝑒𝑐𝑎𝑡𝑖𝑜𝑛 𝑓𝑜𝑟𝑐𝑒 𝑎𝑡 𝐴 = 𝑅 = ;
6
𝑤𝐿
𝑅𝑒𝑐𝑎𝑡𝑖𝑜𝑛 𝑓𝑜𝑟𝑐𝑒 𝑎𝑡 𝐵 = 𝑅 =
3

𝐶𝑜𝑛𝑠𝑖𝑑𝑒𝑟 𝑜𝑛𝑙𝑦 𝑙𝑒𝑓𝑡 𝑠𝑖𝑑𝑒 𝑝𝑎𝑟𝑡 𝑜𝑓 𝑠𝑒𝑐𝑡𝑖𝑜𝑛 𝑿 − 𝑿

𝑡𝑎𝑘𝑒 𝑚𝑜𝑚𝑒𝑛𝑡 𝑤𝑖𝑡ℎ 𝑟𝑒𝑠𝑝𝑒𝑐𝑡 𝑡𝑜 𝑠𝑒𝑐𝑡𝑖𝑜𝑛 𝑿 − 𝑿

𝒘𝒙𝟑
𝑴(𝒙) = 𝑹𝑨 𝒙 − 𝒇𝒐𝒓 𝟎 ≤ 𝒙 ≤ 𝑳
𝟔𝑳

𝑑 𝑦
𝐸𝐼 = 𝑀(𝑥)
𝑑𝑥
𝑑𝑦 1
𝑠𝑙𝑜𝑝𝑒(𝑥) = = 𝑀(𝑥)
𝑑𝑥 𝐸𝐼

1
𝑑𝑒𝑓𝑙𝑒𝑐𝑡𝑖𝑜𝑛(𝑥) = 𝑦(𝑥) = 𝑀(𝑥)
𝐸𝐼

𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛𝑠 𝑡𝑜 𝑒𝑣𝑎𝑙𝑢𝑎𝑡𝑒 𝑐𝑜𝑛𝑡𝑎𝑛𝑡𝑠 𝑑𝑢𝑟𝑖𝑛𝑔 𝑖𝑛𝑡𝑒𝑔𝑟𝑎𝑡𝑖𝑜𝑛

𝑎𝑡 𝑥 = 0 , 𝑦 = 0 ; 𝑎𝑡 𝑥 = 𝐿, 𝑦 = 0;

Example

E=2*(10^11);
I=10^(-4);
w is UDL intensity in N/mm
w=5000;
L=5;
MATLAB code for simply supported beam with point load ‘W’ at a distance ‘a’ from extreme left side of beam

(a) To draw Shear Force, Bending Moment, slope and deflection diagrams
(b) To find out location of maximum deflection and its value

Input parameters:
E=Youngs Modulus or Modulus of elasticity in Pascals or N/m2
I=Area moment of inertia in m4
L=Length of beam in meters
w=Intensity of point load w in N/m

Example:
E=2*(10^11);
I=10^(-4);
w=5000;
L=5;

MATLAB code:
%simply supported beam with UVL uniformly varying load
clear all;
clc;
E=input('Youngs Modulus or Modulus of elasticity in Pascals \n E=');
I=input('Area moment of inertia in m^4\n I=');
L=input('Length of beam in meters \n L=');
w=input('Intensity of point load w in N/m \n w=');
Ra=(w*L/6);
Rb=(0.5*w*L)-Ra;
syms x M(x);
syms C1 C2 C3;
syms slope(x);
M(x)=(Ra*x)-((w*(x)^3)/(6*L));
%first section
format long;
SF(x)=diff(M(x),x);
deflection(x,C2,C3)=((int(int(M(x),x),x))+(C2*x)+C3)/(E*I);
D1y(x,C2,C3)=diff(deflection,x);
eq2 =deflection(0,C2,C3) == 0;
eq3 =deflection(L,C2,C3) == 0;
[aa,bb]= vpasolve([eq2,eq3],[C2,C3]);
C2=eval(aa);
C3=eval(bb);
deflection(x)=deflection(x,C2,C3);
slope(x)=diff(deflection(x),x);
X=0:0.1:L;
figure
area(X,double(SF(X)))
ylabel('Shear Force in N');
xlabel('Location on beam from extreme left along length in m');
figure
area(X,double(M(X)))
ylabel('Bending Moment in N-m');
xlabel('Location on beam from extreme left along length in m');
figure
area(X,double(slope(X)))
ylabel('Slope of bend curvature of beam');
xlabel('Location on beam from extreme left along length in m');
figure
plot(X,double(deflection(X)))
ylabel('Deflection in m');
xlabel('Location on beam from extreme left along length in m');
% Maximum Bending Moment
BM_max_loc=vpasolve(diff(M(x),x)==0,x,[0,L]);
BM_max_loc=eval(BM_max_loc);
max_BM=double(M(BM_max_loc));
fprintf('Maximum BM is at %f m from extreme left side of beam \n',BM_max_loc);
fprintf('Maximum BM is %f N-m \n',max_BM);
% Maximum deflection
Def_max_loc=vpasolve(diff(deflection(x),x)==0,x,[0,L]);
Def_max_loc=eval(Def_max_loc);
max_def=double(deflection(Def_max_loc));
fprintf('Maximum deflection is at %f m from extreme left side of beam \n',Def_max_loc);
fprintf('Maximum deflection is %f m \n',max_def);
Shear Force in N
OUTPUT

Bending Moment in N-m


Slope of bend curvature of beam

Deflection in m
Maximum BM is at 2.886751 m from extreme left side of beam

Maximum BM is 8018.753739 N-m

Maximum deflection is at 2.596648 m from extreme left side of beam

Maximum deflection is -0.001019 m

You might also like