Shear Force Bending Moment

This function SFBM.m calculates and draw the shear force and bending moment diagrams.
11.4K 次下载
更新时间 2024/9/19

查看许可证

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

%% Shear Force & Bending Moment Examples
% This program calculates the shear force and bending moment profiles,
% draws 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
%
%% How to call the function
% To use this program, you need to call the solve function on the instance
% of the SFBMProb object that has the complete problem description.
% You first create the SFBMProb Object and then add the loads in no
% partcular order.
%
%% How to create the SFBMProb object
% create an instance of SFBMProb by calling "SFBMProb" with three
% arguments. The first is the name of the problem. For instance,
% "Example 1", the second argument is Length of the beam, and the third
% is locations of the supports.
%
% prob = SFBMProb(name, length, supports)
%%- Cantilever
% 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, for a cantilever of length 20m, supported at the beginning,
% prob = SFBMProb("Cantilever", 20, 0)
% and if supported at the end,
% prob = SFBMProb("Cantilever", 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,
% prob = SFBMProb("BeamOnFloor", 20, [])
%
%% Set Units
% We have just two primary physical quantities here: Force and Legnth.
% ForceUnit default is KN
% LengthUnit default is m
% but to set a preferred unit, use
%
% prob.ForceUnit = "lb";
% prob.LengthUnit = "inch";
%% Load Description
% Loads can be Force: such point or distributed load, or Torque the we
% call Moment here. In general Load would have value and location.
% The sign of the value can indicate whether it is pointing upwards, or
% downwards in the case of force, or clockwise/anticlockwise in case of
% moment. While moment and point load have scalars for value and
% location, distributed load have vector of value and location.
%% How to add loads to the object.
%
%%- Moment(Torque)
% To add a clockwise moment of magnitude 3KN-m applied at point 5m
% prob.AddMomentLoad(-3, 5);
% For an anticlockwise moment of magnitude 7KN-m applied at point 8m
% prob.AddMomentLoad(7, 8);
%
%%- Concentrated Load(Force)
% To add a downward point load of magnitude 0.8KN applied at point 3m
% prob.AddPointLoad(-0.8, 3);
% For an upward point load of magnitude 5KN-m applied at point 7m
% prob.AddMomentLoad(5, 7);
%
%%- Distributed Force
% To add uniform upward distributed load of magnitude 2KN/m applied from point 3 to 5m
% prob.AddDistLoad([2, 2], [3, 5]);
% For linearly increasing distributed load 2KN/m to 5KN/m applied from point 3 to 5m
% prob.AddDistLoad([2, 5], [3, 5]);
%% Example(1)
%Problem Name
Name = 'Example 1';
%Length and Supports
Length = 10; Supports = [2, 10]; % length = 10, supports at 2 and 10;
prob = SFBMProb(Name, Length, Supports);
%Set Unit
prob.ForceUnit = "lb";
prob.LengthUnit = "inch";
%Concetrated Loads
prob.AddPointLoad(-5, 0); % 5N downward at point 0
prob.AddPointLoad(-10, 8); % 10N downward at point 8
%Torques
prob.AddMoment(10, 3); % ACW 10Nm at point 3
prob.AddMoment(-10, 7); % CW 10Nm at point 7
%Solve the problem
prob.Solve()
[maxshearforce, loc_maxsf] = prob.GetMaxShearForce()
[maxbendmoment, loc_maxbm] = prob.GetMaxBendMoment()
%% Example(2)
%Problem Name
Name = 'Example 2';
%Length and Supports
Length = 20; Supports = 0; % length = 20m, Cantilever supported at 0 m;
prob = SFBMProb(Name, Length, Supports);
%Concentrated Loads
prob.AddPointLoad(-5, 6); % 5N downward at point 6
prob.AddPointLoad(-10, 13); % 10N downward at point 13
%Distributed Loads
prob.AddDistLoad([5,5],[1,3]); % Constant 5N/m upwards from 1m to 3 m
prob.AddDistLoad([-4,-4],[14,17]); % Constant 4N/m downwards from 14m to 17 m
%Solve the problem
prob.Solve()
%% Example(3)
%Problem Name
Name = 'Example 3';
% Length and Supports
Length = 30; Supports = [0,20]; % length = 30m, supports at 0m and 20m;
prob = SFBMProb(Name, Length, Supports);
% Concentrated Loads
prob.AddPointLoad(-20, 6); % 20N downward at point 6
prob.AddPointLoad(-10, 13); % 10N downward at point 13
prob.AddPointLoad(5, 27); % 5N upward at point 27
% Torques
prob.AddMoment(50, 8); % ACW 50Nm at point 8
prob.AddMoment(-45, 25); % CW 45Nm at point 25
% Distributed Loads
prob.AddDistLoad([7, 7], [1,3]); % Constant 7N/m upwards from 1m to 3m
prob.AddDistLoad([-5,-5], [12,18]); % Constant 5N/m downwards from 12m to 18m
% Solve the problem
prob.Solve()
[maxshearforce, loc_maxsf] = prob.GetMaxShearForce()
[maxbendmoment, loc_maxbm] = prob.GetMaxBendMoment()
%% Example(4)
%Problem Name
Name = 'Example 4';
% Length and Supports
Length = 20; Supports = [5,20]; % length = 20m, supports at 5m and 20m;
prob = SFBMProb(Name, Length, Supports);
% Concentrated Loads
prob.AddPointLoad(-2, 0); % 2N downward at point 0
% Torques
prob.AddMoment(50, 8); % ACW 50Nm at point 8
prob.AddMoment(-45, 15); % CW 45Nm at point 15
% Distributed Loads
prob.AddDistLoad([5, 5], [1,3]); % Constant 7N/m upwards from 1m to 3m
prob.AddDistLoad([-4, -4], [14, 17]); % Constant 5N/m downwards from 12m to 18m
% Solve the problem
prob.Solve()
[maxshearforce, loc_maxsf] = prob.GetMaxShearForce()
[maxbendmoment, loc_maxbm] = prob.GetMaxBendMoment()
%% Example(4)
%Problem Name
Name = 'Example 4';
% Length and Supports
Length = 20; Supports = [6,20]; % length = 20m, supports at 5m and 20m;
prob = SFBMProb(Name, Length, Supports);
% Concetrated Loads
prob.AddPointLoad(-2,0); % 2N downward at point 0
% Torques
prob.AddMoment(10,8); % ACW 10Nm at point 8
prob.AddMoment(-15,12); % CW 10Nm at point 12
% Distributed Loads
prob.AddDistLoad([5, 2, 5], [1, 3, 5]); % Constant 5N/m upwards from 1m to 3m and
prob.AddDistLoad([-4, -2, -4],[14, 16, 18]); % Constant 4N/m downwards from 14m to 17m
% Solve the problem
prob.Solve()
[maxshearforce, loc_maxsf] = prob.GetMaxShearForce()
[maxbendmoment, loc_maxbm] = prob.GetMaxBendMoment()

引用格式

Lateef Adewale Kareem (2024). Shear Force Bending Moment (https://www.mathworks.com/matlabcentral/fileexchange/51047-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!

Shear-Force-Bending-Moment

版本 已发布 发行说明
5.52

Update length and force units dynamically

5.51

Update unit of length dynamically

5.5

Get maximum shear force and bending moment and where they occured.

5.4

now you can get the maximum shear force and its location. the same applies for bending moment.

[maxshearforce, loc_maxsf] = prob.GetMaxShearForce();
[maxbendmoment, loc_maxbm] = prob.GetMaxBendMoment();

5.3.5

Added resizing of images to allow concatenation possible.

5.3

Added more examples

5.2

Updated cantilever clamp and also allow user to add the source of the problem.

5.1

publishing as a tool box

5.0

Major upgrade, allowing the user to add/remove one load at a time. Problem plot is also added at a separate figure.

You can also set units for the force and length.

3.7.0

Update for beam lying on the floor

3.6.0

Cantilever drawing update

3.5.0

Better example

2.5.0

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

2.4.0.11

fixed repeated tick problem

2.4.0.10

A little modification with latex axis labelling

2.4.0.9

Updated the plot function for more efficiency

2.4.0.8

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

2.4.0.7

corrected commenting error

2.4.0.6

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

2.4.0.5

Updated to ensure compatibility with Matlab R2018b.

2.4.0.4

Changed the image

2.4.0.3

just changed the image

2.4.0.2

improved on the equation display

2.4.0.1

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

2.4.0.0

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

2.3.0.0

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.

2.2.0.0

corrected a scaling bug int he display.

2.1.0.0

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

2.0.0.0

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

1.0.0.0

bugs in arrow function removed.