Professional Documents
Culture Documents
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);