% SFD BMD plot by Joshua C Wilson_2061206
clc;
disp('Simply Supported Beam');
%% Data input section
Length = input('Length of beam in meter = ');
W = input('Load applied in kN = ');
a = input('Location of Load from left end of the beam in meter = ');
%% Calculation
% b = Length-a;
R1 = W*(Length-a)/Length; % Left Support Reaction.
R2 = W*a/Length; % Right Support Reaction.
% Discretization of x axis.
n = 1000; % Number of discretization of x axis.
delta_x = Length/n; % Increment for discretization of x axis.
x = (0:delta_x:Length)'; % Generate column array for x-axis.
V = []; % Genrate the Empty matrix
M = []; % Genrate the Empty matrix
for i = 1:n+1
% First portion of the beam, 0 < x < b
V(i) = R1;
M(i) = R1*x(i);
% Second portion of the beam, b < x < Length
% Moment the value of a increase it will switch to other loop.
% Basically other side of the beam.
if x(i) >= a
V(i) = R1-W;
M(i) = R1*x(i)-W*(x(i)-a);
end
end
Mmax= max(M)
disp(' '); % Just to keep some gap between output Empty display
disp(' ');
disp(['Left support Reaction in kN is ' num2str(R1)])
disp(['Right support Reaction in kN is ' num2str(R2)])
disp(['Maximum bending moment in is ' num2str(max(M)) 'kN-m'])
% Plottinng of diagram
figure
subplot(2,1,1);
plot(x, V, 'r','linewidth',1.5);
% Advance plot
grid
title('Shear Force Diagram','fontsize',16)
subplot(2,1,2);
plot(x, M, 'k','linewidth',1.5);
grid
title('Bending Moment Diagram','fontsize',16)
Cite As
Adeeb Raza (2026). gandupoint1 (https://www.mathworks.com/matlabcentral/fileexchange/136399-gandupoint1), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2023b
Compatible with any release
Platform Compatibility
Windows macOS LinuxTags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0 |
