Professional Documents
Culture Documents
and shear force diagram for beam loaded as indicated in the figure right
next.
Write a function that will allow you to redraw the both the shear force
and bending mom ent diagrams.
Apply your program and pick any along the span of the beam and
check if your results m ake sense.
2021/05/12 4:46 PM C:\Users\DF Sozinando\D...\beam1.m 1 of 2
clc
clear
close all
%Data
FA=20;%kN
FC=40;%kN
LAB=2.5;%m
LBC=3;%m
LCD=2;%m
L=7.5;%m
E=200*10^6;%kPa
I=24*10^-6;%m^4
%Reaction
syms RB RD %Unknowns
%Sum of moment at D
equ1=-FA*(LAB+LBC+LCD)+RB*(LBC+LCD)-FC*LCD==0;
%Sum of moment at B
equ2=-FA*LAB+FC*LBC-RD*(LBC+LCD)==0;
%Solving RB and RD
[RB RD]=solve([equ1 equ2],[RB RD]);
RB=double(RB)
RD=double(RD)
%Range of x
dx=0.001; % Increment for discretization of beam length
x=0:dx:L; % range variable of beam length
subplot(2,1,2)
bar(x,M);
2021/05/12 4:46 PM C:\Users\DF Sozinando\D...\beam1.m 2 of 2
xlabel('Length [m]')
ylabel('BM [kNm]')
title('Bending Moment Diagram')
set(gcf,'color','white');
box on;
grid on;
%Numerical Integration
slope0=cumtrapz(M)*dx;
deflect0=cumtrapz(slope0)*dx;
%Boundary condintion
%n=((last-first)/dx)+1
x1=2.5;
x2=7.5;
n1=((x1-0)/dx)+1;
n2=((x2-0)/dx)+1;
%Finding constant C
C=-[x1,1;x2,1]\[deflect0(n1);deflect0(n2)];
figure(2)
subplot(2,1,1)
plot(x,slope);
xlabel('Length [m]')
ylabel('slope [rad]')
title('Slope Diagram')
grid on
subplot(2,1,2)
plot(x,y);
xlabel('Length [m]')
ylabel('Deflection [m]')
title('Deflection Diagram')
grid on