Documentos de Académico
Documentos de Profesional
Documentos de Cultura
clc
clear all
%To get basic inputs from the user "length"; "Width"; "Depth" of Beam c/s
%and "Youngs Modulus" of beam cross section
l=input('Enter
B=input('Enter
D=input('Enter
E=input('Enter
I=(B*D^3)/12;
the
the
the
the
end
dfu=dfu+df1u;
end
%Uvl
for i=1:1:nuvl
if(i==1)
if(uvl(1,i)==1)
[bmv,sfv,dfv]=UVLMAXMIN(l,E,I,0,uvl(2,i),uvl(3,i));
else
[bmv,sfv,dfv]=UVLMINMAX(l,E,I,0,uvl(2,i),uvl(3,i));
end
else
if(uvl(1,i)==1)
[bm1v,sf1v,df1v]=UVLMAXMIN(l,E,I,0,uvl(2,i),uvl(3,i));
bmv=bmv+bm1v;
sfv=sfv+sf1v;
dfv=dfv+df1v;
else
[bm1v,sf1v,df1v]=UVLMINMAX(l,E,I,0,uvl(2,i),uvl(3,i));
bmv=bmv+bm1v;
sfv=sfv+sf1v;
dfv=dfv+df1v;
end
end
end
%Moment calculation
for i=1:1:nm
if(i==1)
[bmm,sfm,dfm]=moment(l,E,I,mo(1,i),mo(2,i));
else
[bm1m,sf1m,df1m]=moment(l,E,I,mo(1,i),mo(2,i));
bmm=bmm+bm1m;
sfm=sfm+sf1m;
dfm=dfm+df1m;
end
end
%adding different cases BM SF and DF
if((npl==0)&&(nudl==0))
BM=bmv+bmm;
SF=sfv+sfm;
DF=dfv+dfm;
elseif((nudl==0) && (nuvl==0))
BM=bmp+bmm;
SF=sfp+sfm;
DF=dfp+dfm;
elseif((npl==0) && (nuvl==0))
BM=bmu+bmm;
SF=sfu+sfm;
DF=dfu+dfm;
elseif((npl==0) && (nm==0)
BM=bmu+bmv;
SF=sfu+sfv;
DF=dfu+dfv;
elseif((nudl==0) && (nm==0)
BM=bmp+bmv;
SF=sfp+sfv;
DF=dfp+dfv;
elseif((nuvl==0) && (nm==0)
BM=bmp+bmu;
SF=sfp+sfu;
DF=dfp+dfu;
elseif((npl==0))
BM=bmu+bmv+bmm;
SF=sfu+sfv+sfm;
DF=dfu+dfv+dfm;
elseif((nudl==0))
BM=bmp+bmv+bmm;
SF=sfp+sfv+sfm;
DF=dfp+dfv+dfm;
elseif((nuvl==0))
BM=bmp+bmu+bmm;
SF=sfp+sfu+sfm;
DF=dfp+dfu+dfm;
elseif((nm==0))
BM=bmp+bmu+bmv;
SF=sfp+sfu+sfv;
DF=dfp+dfu+dfv;
else
BM=bmp+bmv+bmu+bmm;
SF=sfp+sfv+sfu+sfm;
DF=dfp+dfv+dfu+dfm;
end
%storing max moment,shear force and deflection
maxM=max(abs(BM));
maxF=max(abs(SF));
maxy=max(abs(DF));
%storing address of max moment,shear force and deflection
for i=1:length(BM)
if(BM(i)==max(abs(BM)))
Mmax=i;
end
if(SF(i)==max(abs(SF)))
Fmax=i;
end
if(DF(i)==max(abs(DF)))
Ymax=i;
end
end
xaxis=0:0.01:l;
% plotting of beams
ex=[0 l]
y=[0 0]
figure(1);
subplot(4,1,1)
plot(ex,y,'k','linewidth',5);
hold on
for i=1:1:npl
[x]=ptld(pl(1,i));
end
for i=1:1:nudl
[x]=udlpt(udl(1,i),udl(2,i));
end
for i=1:1:nuvl
if(uvl(1,i)==1)
[x]=uvlpt(0,uvl(2,i));
else
[x]=uvlpti(0,uvl(2,i));
end
end
for i=1:1:nm
[x]=mplot(mo(1,i));
end
exx=[0 0];
eyy=[-0.3 0.3];
plot(exx,eyy,'k','linewidth',30)
xlim([0 l]);
title('Beam Representation');
hold off
subplot(4,1,2)
plot(ex,y);hold on
plot(xaxis,BM,'r','linewidth',2)
%xlim([-1 (l+1)]);
title('Bending Moment');
hold off
subplot(4,1,3)
plot(ex,y);hold on
plot(xaxis,SF,'g','linewidth',2)
%xlim([-1 (l+1)]);
title('Shear Force');hold off
subplot(4,1,4)
plot(ex,y);hold on;
plot(xaxis,DF,'b','linewidth',2)
%xlim([-1 (l+1)]);
title('Deflection');hold off
figure(2)
B=1000*B;
D=1000*D;
subplot(1,2,1)
[x]=sstress(B,D,maxF);
subplot(1,2,2)
[x]=bstress(B,D,maxF);
%FUNCTION DEFINITION
%PURPOSE: To bending moment, shear force and deflection values of a point load
%l = length of the beam
%E = Youngus modulus of the beam
%I = Moment of inertia
%locn = Location of point load from the left end
%value = Point load magnitude
%BM = Bending moment array
%SF = Shear force array
%Y = Deflection array
function[BM,SF,Y]=pointload(l,E,I,locn,value)
l=l;
a=locn;
w=value;
E=E;
I=I;
Ra= w;
Ma= w*a;
x=0:0.01:l;
% EQUATIONS USED:
%
When (x<= a)
%
SF= Ra
%
BM= (Ra * x Ma)
%
Y = ((Ra * x3 )/6 - ( Ma * x2) /2)/(E*I)
%
When (x>a)
%
SF = 0
%
BM= 0
%
Y= (Y((a*100)+1)+(Y((a*100)+1)*(x-a)/a))
for
i=1:length(x);
if (x(i) <= a)
SF(i)= Ra/(E*I);
BM(i)= (Ra * x(i) - Ma)/(E*I);
Y(i) = (Ra * x(i)^3 /6 - ( Ma * x(i)^2 /2))/(E*I);
else
SF(i) = 0;
BM(i) = 0;
Y(i) = (Y((a*100)+1)+(Y((a*100)+1)*(x(i)-a)/a))
end
end
end
%FUNCTION DEFINITION
%Purpose : To draw the bending moment Shear force diagram and deflection
diagram for a udl
%l = length of the beam
%E = Youngus modulus of the beam
%I = Moment of inertia
%spoint= start point of udl from left end
%length= Length of udl
%Value = Magnitude of uvl at start point
%BM = Bending moment array
%SF = Shear force array
%Y = Deflection array
function [BM SF Y]=UDL(l,E,I,spoint,lengthh,value)
l=l;
a=spoint;
b=(spoint+lengthh);
w=value;
E=E;
I=I;
Ra= w*(b-a);
Ma= w*(b-a) * (a + (b-a)/2);
x=0:0.01:l;
%EQUATIONS USED
%
when(x <= a)
%
SF = Ra
%
BM = Ra*x - Ma
%
Y = ((Ra* x3)/6 -( Ma*x2)/2))/(E*I)
%
%
when(x >= a) && (x <= b)
%
SF = Ra-w*( x-a)
%
BM = Ra*x-Ma-(w*(x-a)2)/2
%
Y =((Ra*x3 )/6-((Ma* x2)/2 )-(w*(x - a)4)/24)/(E*I))
%
%
when(x =l)
%
SF = 0
%
BM = 0
%
Y = (Y((b*100)+1)+(Y((b*100)+1)*(x-b)/b))
for
i=1:length(x);
if (x(i) <= a)
SF(i)= Ra/(E*I);
BM(i)= (Ra * x(i) - Ma)/(E*I);
Y(i) = (Ra * x(i)^3 /6 - ( Ma * x(i)^2 /2))/(E*I);
BM(i) = 0;
Y(i) = (Y((b*100)+1)+(Y((b*100)+1)*(x(i)-b)/b))
end
end
end
function [BM,SF,Y]=UVLMAXMIN(l,E,I,spoint,lengthh,value)
l=l;
a=lengthh;
w=value;
E=E;
I=I;
Ra= w * a/2;
Ma= w*a^2 /3;
x=0:0.01:l;
%EQUATIONS USED
%
when (x <= a)
%
)
%
Y = -(w*a2*x2/12 -( w*a*x3)/12) + (w/2*a)*(a*(x4/12)-x5/20)+1/3*( w*x4/12
-(w/a*(x4/12*a-x5 /20))/(E*I)
%
%
when (x <= l)
SF = 0;
%
%
BM = 0;
Y = (Y((a*100)+1)+(Y((a*100)+1)*(x-a)/a))
for
i=1:length(x);
if (x(i) <= a)
(2*x(i)*w -
x(i)^2
function [BM,SF,Y]=UVLMINMAX(l,E,I,spoint,lengthh,value)
l=l;
a=lengthh;
w=value;
E=E;
I=I;
% 03*03
Ra= w * a/2;
Ma= w*a^2 /3;
x=0:0.01:l;
% EQUATIONS USED
% When (x <= a)
%
SF(i) = (Ra- ( (x)2 * (w/(2*a) ) ))
%
BM(i) = (Ra * x-(w * x3 )/(6 * a) - Ma)
%
Y(i) =( (Ra*x3 )/6 - w*x4 /(120*a)-Ma*x2/2 )/(E*I)
% When(x>a)
%
SF = 0
%
BM = 0
%
Y = (Y((a*100)+1)+(Y((a*100)+1)*(x-a)/a))
for
i=1:length(x);
if (x(i) <= a)
SF(i) = (Ra - ( (x(i))^2 * (w/(2*a) ) ))/(E*I);
MOMENT
%FUNCTION DEFINITION
% Purpose : To get the Shear force diagram, Bending moment diagram,
%Deflection diagram of a beam subjected to a concentrated moment.
%l = length of the beam
%E = Youngus modulus of the beam
%I = Moment of inertia
%locn = Location of point load from the left end
i=1:length(x);
if (x(i) <= a)
SF(i) = 0;
BM(i) =- Ma/(E*I);
Y(i) =-((Ma * x(i)^2 )/2)/(E*I);
else
end
SF(i) = 0;
BM(i) = 0;
Y(i) = (Y((a*100)+1)+(Y((a*100)+1)*(x(i)-a)/a));
end
end
BENDING STRESS
%Definition
%Purpose : To plot the Bending Stress across the cross section
%Function to calculate the Bending stress
%b=width of the beam
%d=depth of the beam
%M=max bending moment
function [x]=bstress(b,d,M)
b=b;
d=d;
I = b*d^3 /12;
M=M;
i=0;
%EQUATIONS USED
%M/I=f/y
%f=(M*y/I)
for y=-d/2:0.01:d/2
i=i+1;
if((i==1))
f(i)=0;
elseif ((y==d/2))
f(i)=0;
else
f(i)=M*y/I;
end
end
y=-d/2:0.01:d/2
x=[0 0]
ey=[-d/2 d/2]
plot(x,ey)
hold on
plot (f,y)
title('Bending Stress');
end
SHEAR STRESS
%Purpose : to plot shear stress across the cross section
%b=width of the beam
%d=depth of the beam
%maxsf=max shear force
function [x]=sstress(b,d,maxsf)
b=b;
d=d;
x=0;
x2=[0 0];
y2=[-150 150];
a=b*d;
v=maxsf;
I=(b*d^3)/12;
d1=-d/2:0.1:d/2;sss=zeros(length(d1),1);A=(0);y=(0);
%
%
%
%
EQUATIONS USED
A=(b*((d/2)-d1))
y=(((d/2)-d1)/2)+d1
sss=(v*A)*(y)/(I*b)
for MI=1:1:length(d1)
A(MI)=(b*((d/2)-d1(MI)));
y(MI)=(((d/2)-d1(MI))/2)+d1(MI);
sss(MI)=(v*A(MI))*(y(MI))/(I*b);
end
plot(sss,d1,x2,y2)
hold on
title('Shear stress')
SOLUTION
User inputs
Enter
Enter
Enter
Enter
the
the
the
the
UDL
UDL
UDL
UDL
details of load no 1
Start point from left end= 6
length= 2
Value= 18
Obtained result