# Need help Matlab programming for shear force and bending moment diagrams of a beam

1. Apr 13, 2012

### skhii

Need help!!Matlab programming for shear force and bending moment diagrams of a beam

1. The problem statement, all variables and given/known data
A program is required that will calculate the shear force and bending moment diagrams for a
cantilevered beam of arbitrary length. The loads may be point loads or distributed loads,or a combination of the two, but no moments will be directly applied to the beam.

A simple method of integrating the shear force diagram to produce the bending moment diagram is the trapezoidal method. must be via GUIs. Bonus marks, up to a maximum of 10%, are allowed for features that make the program more generically applicable, flexible or decidedly robust

2.

3. So far I am trynig to plot the shear force diagram for the beam experiencing only point loads.My graph is incorrent and I would realy appreciate if someone would correct the code I have so far.Here is my code so far:

Q=questdlg('what types of loads are applied to the beam?', ...
switch Q
X=B(:,1);%position of point loads along beam

shear=-(sum(V));%shear1=reaction force at root of beam

for n=(0:0.01:L);
if x1<=X(1)
shear1(n<=X(1))=shear;
else
shear1=0;
end

if X(1)<n<=X(2);
shear2=shear1+V(1);
else
shear2=0;
end
if X(2)<n<X(3);
shear3=shear2+V(2);
else
shear3=0;
end
if X(3)<n<=L
shear4=shear3+V(3);
else
shear4=0;
end
end
plot(n,shear1,n,shear2,n,shear3,n,shear4)

end