Shear Force Bending Moment

版本 3.7.0 (771.3 KB) 作者: Lateef Adewale Kareem
This function SFBM.m calculates and draw the shear force and bending moment diagrams.

9.3K 次下载

更新时间 2022/8/8


编者注: This file was selected as MATLAB Central Pick of the Week

This file explains how to use the SFBM.m code. as well as supporting
accessories. SFBM means Shear Force & Bending Moment.
This program calculates the shear force and bending moment profiles, draw
the free body, shear force and bending moment diagrams of the problem.
Under the free body diagram, the equations of each section is clearly
written with Latex
To use this program, you call the function placing the arguments in cells
with keywords at the beginning of each cell except for the first 2 arguments.
First Argument
The first argument is the name of the problem as a string e.g.: 'PROB 1'.
Second Argument
-Simply supported beam
The second argument is a row vector containing length of the beam and
location of the supports, for example, if the length of the beam is 20m and
has 2 supports, one at 3m and the other at 17m, the second argument will
thus be: [20, 3, 17]
If the problem is a cantilever problem, then you have only one clamped
support, at the beginning or end of the beam. In such a case, the number is
second argument contains 2 elements instead of three. For instance, fir a
cantilever of length 20m, supported at the beginning, the second argument
would be [20,0], and if supported at the end, we have [20,20].
-Beam on the floor
Its possible to have a problem in which the body is lying on the floor
without any point support. In such scenario, the second argument will just
be the length of the beam
Third argument and on
From the third argument and onward, we use cells. The first element of the
cell contains a keyword describing what type of load is inside the argument.
The second element is the magnitude of the load while, the third element of
a cell argument is its location.
Keywords: Point Load = 'CF'
Moment = 'M'
Distributed Load = 'DF'
To add a downward point load of magnitude 5N at location 4m, the argument
would be {'CF',-5,4}. Note the negative sign. If the force is acting upward
the argument would be {'CF',5,4};
To add a clockwise moment of magnitude 10N-m at location 14m, the argument
would be {'M',-10,14}. Note the negative sign. If the moment is anticlockwise
the argument would be {'M',10,14};
To add distributed load we need to describe all of them with the minimum
number of point required to describe the profile with the highest
complexity. For example, a linear profile can be described as {'DF',[5,5],[2,10]}
meaning uniform force per unit length of 5N/m from point 2m to 10m. If the
values of the profile were given at 3 points, the code will automatically
assume it to be quadratic. If profile is uniform, the coefficient of the
second and first degrees would be zero.Hence describing the constant 5N/m
from 2m to 10m as {'DF',5,[2,10]}, {'DF',[5,5],[2,10]}, {'DF',[5,5,5],[2,8,10]}
will make no difference. But in case where the values in the force vector
are different, SFBM will generate a polynomial fit for the forces as a
function of position. For instance {'DF',[1,5,5],[2,8,10]} will generate a
quadratic function, while {'DF',[1,4,5],[2,8,10]} will generate a linear
expression and {'DF',[5,5,5],[2,8,10]}will generate a degree zero expression
There is no limit to the number degree of polynomial that can be used.
its is important that all concentrated loads and torques are listed in the
order of locations
For example:
SFBM('Prob 200',[20,5,20],{'CF',-2,0},{'M',10,8},{'DF',5,[1,3]},{'M',-10,12},{'DF',-4,[14,17]})
Name : Prob 200
Length: 20m
Supports: 5m and 20m
Point Load: 2N at point 0
Distributed Load: Constant 5N/m from 1m to 3m and Constant -4N/m from 14m to 17m
Moment: ACW 10Nm at point 8m and CW 10Nm at point 12
The Freebody (with Legend), Shear Force and Bending moment diagrams are generated and saved in picture format titles Prob 200.png.


Lateef Adewale Kareem (2023). Shear Force Bending Moment (, MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2013b
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!


版本 已发布 发行说明

Update for beam lying on the floor


Cantilever drawing update


Better example


Added problem diagram. Also modified the drawing of the loads.

fixed repeated tick problem

A little modification with latex axis labelling

Updated the plot function for more efficiency

handles the error of parent function sharing variable with a nested function

corrected commenting error

Corrected a rendering problem for cases where no force is applied.

Updated to ensure compatibility with Matlab R2018b.

Changed the image

just changed the image

improved on the equation display

There is a major bug. Where the special point function returns a polynomial an order higher than the polynomial describing the curve.

This has been corrected after being pointed out by David Zhang

Corrected an bug in the use of arrow in line 86 of Diagram.

added new function Round to perform the function of round(v,n) in version of matlab later than 2012b. Another function DrawArrow has been added to draw better arrows than the ones drawn by quiver function.

corrected a scaling bug int he display.

A bug concerning failure of the code to return the equations of bending moment and shear force from the beginning of the beam was fixed

This file has now been updated to deal with cantilever (a system with just one support). It can also handle cases of beams lying on the floor with the reaction being just distributed load.

Equation texts is now interpreted with latex

bugs in arrow function removed.