Friday, September 21, 2012

MATLAB code for plotting SFD,BMD & Deflection in case of propped cantilever under UDL


%one side fixed and other side simply supported with udl
% SINGLE SPAN BEAMS
%- SFD
%- BMD
%- Deflection
clear all
clc
fprintf(' |     one side fixed and other side simply supported with udl       |\n')
fprintf('                   --------------------------------                   \n ')
fprintf('\n')
%diamensions of beam
L=2000; %length of the beam
B=200; %breath of the beam
D=200; %depth of the beam
M20=20;%grade of concrete
w=2000;%load
E=5000*sqrt(M20);
I=(B*D^3)/12;
k=0;
for x=0:0.2:L
    k=k+1;
    sf(k)=(w/8)*(3*L-8*x);
    sf1(k)=0;
    m(k)=(w*x/8)*(3*L-4*x);
    m1(k)=0;
    y(k)=((w*x)/(48*E*I))*(L^3-3*L*x^2+2*x^3);
    y1(k)=0;
end
 
    subplot(3,1,1)
    plot(x,sf,x,sf1,'linewidth',1);
    title('shear force');
    xlabel('length of beam in mm');
    ylabel('shear force in N');
 
    subplot(3,1,2)
    plot(x,m,x,m1,'linewidth',2);
    title('bending moment');
    xlabel('length of beam in mm');
    ylabel('bending moment in N-mm');
   
    subplot(3,1,3)
    plot(x,y,x,y1,'linewidth',1);
    title('diflection');
    xlabel('length of beam in mm');
    ylabel('diflection in mm');