NOTE Your MATLAB Assignment should clearly show your typed i
Solution
clear all
clc
fprintf(\'Title:beam with point load at centre and two UDL at ends\ \');
%Dimensions
L=input(\'Length of the beam in m: \');
%Loads
w=input(\'Enter the Load in KN : \');
w1=input(\'Enter the Load in KN/m : \');
%Moments
Mc=((58*w*L)/(1215))+((11*w1*L^2)/(180));
Md=((10*w*L)/(54))-((Mc)/(2));
Mb=((w1*L^2)/(4))+((10*w*L)/(54))-((7*Mc)/(2));
Ma=((10*w)/(54))-((Mb)/(2));
%Reactions
Ra=((Ma-Mb)/(L))+((2*w)/(3));
Rd=((Md-Mc)/(L))+(w/3);
Rb=((Ma-Mc)/(L))-(2*Ra)+((5*w)/(3))+((w1*L)/(2));
Rc=((Md-Mb)/(L))-(2*Rd*L)-((4*w)/(3))+((w1*L)/(2));
i=0;
for X=0:0.01:(3*L)
i=i+1;
if X<(L/3)
SF(i)=Ra;
SF1(i)=0;
BM(i)=(Ra*X)-(Ma);
BM1(i)=0;
elseif X>=(L/3)&&X<=L
SF(i)=Ra-(w);
SF1(i)=0;
BM(i)=(Ra*X)-(w*(X-(L/3)))-(Ma);
BM1(i)=0;
elseif X>=L&&X<=(2*L)
SF(i)=Ra-(w)+Rb-(w1*(X-L));
SF1(i)=0;
BM(i)=(Ra*X)-(w*(X-(L/3)))-(Ma)+(Rb*(X-L))-(w1*((X-L)^2)*0.5);
BM1(i)=0;
elseif X>=(2*L)&&X<=((7/3)*L)
SF(i)=-Rd+w;
SF1(i)=0;
BM(i)=(Rd*((3*L)-X))-Md-(w*((2.33*L)-X));
BM1(i)=0;
else
SF(i)=-Rd;
SF1(i)=0;
BM(i)=(Rd*((3*L)-X))-Md;
BM1(i)=0;
end
end
X=0:0.01:(3*L)
%Plot Shear Force
subplot(2,1,1);
plot(X,SF,X,SF1);
title(\'Shear Force Diagram\');
xlabel(\'Length of the Beam in m\');
ylabel(\'Shear Force in KN\');
%Plot Bending Moment
subplot(2,1,2);
plot(X,BM,X,BM1);
title(\'Bending Moment Diagram\');
xlabel(\'Length of the Beam in m\');
ylabel(\'Bending Moment in KN-m\');

