Friday, September 21, 2012

MATLAB coding for Plotting SFD's and BMD's for different cases in continuous beams


a)
CONTINUOUS SPAN BEAMS
%- SFD
%- BMD
clear all
clc
fprintf('Title:continuous beam with half UDL and Moment\n');
%diamensions of beam
L=2000; %Total length of the beam
L1=1000;%Length of Span AB
L2=L1;%Length of span BC
B=200; %breath of the beam
D=200;  %depth of the beam
M20=20;%grade of concrete
w=2000; %load
E=5000*sqrt(M20);
a=1000;
b=1000;
L=L1+L2;
Ra=(7*w*L1)/16;
Rb=(5*w*L1)/8;
Rc=(w*L1)/16;
I= (B*D^3)/12;
j=0;
for x=0:1:L
    j=j+1;
    if x<L1
    sf(j)=Ra-w*x;
    sf1(j)=0;
    bm(j)=Ra*x-(w*x^2)/2;
    bm1(j)=0;
    else
    sf(j)=Rc;
    sf1(j)=0;
    bm(j)=Rc*(L-x);
    bm1(j)=0;
    end
end
x=0:1:L
subplot(3,1,1)
plot(x,sf,x,sf1,'linewidth',2);
title('shear force');
xlabel('length of the beam in mm');
ylabel('shear force in n');

subplot(3,1,2)
plot(x,bm,x,bm1,'linewidth',3);
title('bending moment');
xlabel('length of the beam in mm');
ylabel('bending moment in n-mm');

---------------------------------------------------------------------------
b)
clear all   
clc
fprintf('Title:continuous beam with half UDL and Moment\n');

%Dimensions
L=input('Length of the beam in m: ');
%Loads
w=input('Enter the Load in KN/m : ');
M=input('Enter the Moment in KN-m : ');
%Moments
Mb=((-w*L^2)/(24))-((24*M)/(150));
Ma=((w*L^2)/(8))-((Mb)/(2));
Mc=((-2*M)/(50))-((Mb)/(2));
%Reactions
Ra=((Ma-Mb)/(L))+((w*L)/(2));
Rc=((Mc-Mb)/(L))+(M/L);
Rb=(w*L)-(Ra)-(Rc);
i=0;
for X=0:0.02:(2*L);
    i=i+1;
    if X<=L
        SF(i)=Ra-(w*X);  
        SF1(i)=0;
        BM(i)=(Ra*X)-((w*X^2)*0.5)-Ma;  
        BM1(i)=0;   
    elseif X>=L&&X<=(1.6*L)
        SF(i)=Ra+Rb-(w*L); 
        SF1(i)=0;
        BM(i)=(Rc*((2*L)-X))-Mc-M; 
        BM1(i)=0;
    else
        SF(i)=Ra+Rb-(w*L); 
        SF1(i)=0;
        BM(i)=-Mc+(Rc*((2*L)-X)); 
        BM1(i)=0;
    end
end
X=0:0.02:(2*L);
% ploting the SF,&BM

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');

% ploting the SF,&BM

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');

---------------------------------------------------------------------------


c)
clear all
clc
fprintf('Title:continuous beam with point load\n');


% Dimensions of the Beam
L=input('length of the Beam in m: ');

%Load
w=input('Enter the Load in KN/m: ');

%Moments
Ma=w*L/6;
Mb=w*L/24;
Mc=-w*L/48;
%Reactions
Ra=((Ma-Mb)/L)+(w/2);
Rc=((Mc-Mb)/(2*L));
Rb=w-Ra-Rc;

i=0;
for X=0:0.002:(3*L)
    i=i+1;
   if X<L/2
       SF(i)=Ra;
       SF1(i)=0;
       BM(i)=(Ra*X)-Ma;
       BM1(i)=0;
   elseif X>=L/2&&X<=L
       SF(i)=Ra-w;
       SF1(i)=0;
       BM(i)=(Ra*X)-w*(X-(L/2))-Ma;
       BM1(i)=0;
   else
       SF(i)=Ra+Rb-w;
       SF1(i)=0;
       BM(i)=(Ra*X)+(Rb*(X-L))-(w/2*(2*X-L))-Ma;
       BM1(i)=0;
   end
end
X=0:0.002:(3*L);

% ploting the SF,&BM

subplot(2,1,1)
plot(X,SF,X,SF1)
xlabel('Length of the beam in m')
ylabel('Shear Force in KN')
title('Shear force diagram')

subplot(2,1,2)
plot(X,BM,X,BM1)
xlabel('Length of the beam in m')
ylabel('Bending Moment in KN-m')
title('Bending Moment diagram')

---------------------------------------------------------------------------

d)
clear all
clc
fprintf('Title:continuous beam with two point loads and UDL \n');

% Dimensions of the Beam
L=input('length of the Beam in m: ');

%Load
w1=input('Enter the UDL in KN/m: ');
w2=input('Enter the point load in KN/m: ');

%Moments
Ma=5*(w1*L^2)/48-1/32*w2*L;
Mb=(w1*(L^2)/24)+(w2*L/16);
Mc=5*(w2*L)/32-1/48*w1*(L^2);

%Reactions
Ra=((Ma-Mb)/L)+(w1*L/2);
Rc=((Mc-Mb)/L)+w2/2;
Rb=(w1*L)+w2-Ra-Rc;

i=0;
for X=0:0.002:(3*L)
    i=i+1;
   if X<L
       SF(i)=Ra-(w1*X);
       SF1(i)=0;
       BM(i)=(Ra*X)-Ma-(w1*(X^2)*0.5);
       BM1(i)=0;
   elseif X>=L&&X<1.5*L
       SF(i)=Ra-(w1*L)+Rb;
       SF1(i)=0;
       BM(i)=(Ra*X)+(Rb*(X-L))-w1*L*((0.5*L)+(X-L))-Ma;
       BM1(i)=0;
   else
       SF(i)=Ra+Rb-(w1*L)-w2;
       SF1(i)=0;
       BM(i)=(Ra*X)+(Rb*(X-L))-w1*L*((0.5*L)+(X-L))-Ma-(w2*(X-1.5*L));
       BM1(i)=0; 
   end
  
end
X=0:0.002:(3*L);

% ploting the SF,&BM

subplot(2,1,1)
plot(X,SF,X,SF1)
xlabel('Length of the beam in m)')
ylabel('Shear Force in KN')
title('Shear force diagram')

subplot(2,1,2)
plot(X,BM,X,BM1)
xlabel('Length of the beam in m)')
ylabel('Bending Moment in KN-m')
title('Bending Moment diagram')



---------------------------------------------------------------------------

e)
clear all
clc
fprintf('Title:continuous beam with UDL at centre and two points loads at some distance from free end\n');

%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');

---------------------------------------------------------------------------

f)
clear all
clc
fprintf('Title: continuous beam with UDL at centre and point loads at some distance from left end\n');

% Dimensions of the Beam
l=input('length of the Beam in m: ');

%Load
w=input('Enter the UDL in KN/m: ');
w1=input('Enter the PointLoad in KN/m: ');
%Moments
Ma=((-3*w1*l^2)/104)+((3*w*l)/208);
Mb=(-2*Ma);
Mc=((5*w1*(l^2))/104)+((21*w*l)/208);
%Reactions
Ra=(Ma-Mb)/l;
Rb=((Ma-Mc)/l)-(2*Ra)+((w1*l)/2);
Rd=(-Mc/l)+(w/2);
Rc=(-Mb/l)-(2*Rd)+(3*w/2)+(w1*l/2);
i=0;
for X=0:0.02:(3*l);
    i=i+1;
    if(X<l)
        SF(i)=Ra;
        SF1(i)=0;
        BM(i)=(Ra*X)-Ma;
        BM1(i)=0;
    elseif(X>=l&&X<2*l)
        SF(i)=Ra+Rb-(w1*(X-l));
        SF1(i)=0;
        BM(i)=(Ra*X)+Rb*(X-l)-(w1*((X-l)^2)*0.5)-Ma
        BM1(i)=0;
    elseif(X>=2*l&&X<2.5*l)
        SF(i)=-Rd+w;
        SF1(i)=0;
        BM(i)=(Ra*X)+Rb*(X-l)-Ma-w1*l*((l*0.5)+(X-(2*l)))+(Rc*(X-(2*l)));
        BM1(i)=0;
       
    else
        SF(i)=-Rd;
        SF1(i)=0;
        BM(i)=Rd*((3*l)-X);
        BM1(i)=0;
    end
end

X=0:0.02:(3*l);

subplot(2,1,1);
plot(X,SF,X,SF1)
xlabel('Length of the beam in m')
ylabel('Shear Force in KN')
title('Shear force diagram')

subplot(2,1,2)
plot(X,BM,X,BM1)
xlabel('Length of the beam in m')
ylabel('Bending Moment in KN-m')
title('Bending Moment diagram')
---------------------------------------------------------------------------

5 comments:

  1. great but can you explain to me more

    ReplyDelete
  2. great but can you explain to me more

    ReplyDelete
  3. Sir please can you help me to write code for finding SFD and BMD for n point loads and concentrated moment

    ReplyDelete
  4. Sir please can you help me to write code for finding SFD and BMD for n
    udl loads and concentrated moment

    ReplyDelete
  5. we are one of the leading firm in the field of Mobile Mapping from UAE.
    Mobile Mapping Systems Dubai
    for more information you can contact us +971 4 2520666

    ReplyDelete