Samlpe Codes
Samlpe Codes
|
SIMPLE AND FIXED
|\n')
---------------------------------\n ')
% A = input('type a value')
% Dimensions of Beam
L = 3000; % Length
B = 300; % Breadth
D = 300; % Depth
% Material Properties
GC = 20;
% Grade of Concrete
% Loading Conditions
PL = 20; % In kN
UDL = 20; % In kN
% Boundary Conditions
% ?????????????
% Claculations
E = 5000 * sqrt(GC);
I = (B*(D^3))/12 ;
i=0;
for x=0:0.2:L
i=i+1;
% Simply Supported
df(i) = ((UDL*x)/(24*E*I))*((L^3) - 2*L*(x^2) +
x^3);
df1(i)=0;
sf(i) = UDL*((L/2) - x);
sf1(i)=0;
bm(i) = ((UDL * x)/2)*(L-x);
bm1(i)=0;
% Cantilever with UDL
c_df(i) = (UDL/(24*E*I))*(x^4 - 4*L^3*x +
3*L^4);
c_sf(i) = UDL*x;
c_bm(i) = (UDL*x^2)/2 ;
% Cantilever with point load at the end
c_pl_df(i)= (PL/(6*E*I))*(2*(L^3) - 3*(L^2)*x +
(x^3));
c_pl_sf(i)= PL;
c_pl_bm(i)= PL*x;
% One side fixed and other side simple
supported
r1 = ((3*UDL*L)/8);
r2 = ((5*UDL*L)/8);
fs_df(i) = ((UDL*x)/(48*E*I))*(L^3
2*x^3);
fs_sf(i) = r1-UDL*x;
fs_bm(i) = r1*x - (UDL*(x^2))/2 ;
end
% Plotting the results
x=0:0.2:L;
subplot(3,1,1)
plot(x,fs_df,x,df1,'LineWidth',2)
title('Deflection')
xlabel('Length of Beam in mm')
ylabel('Deflection in mm')
subplot(3,1,2)
plot(x,fs_sf,x,sf1,'LineWidth',2)
title('Shear force diagram')
xlabel('Length of Beam in mm')
ylabel('Shear force in kN')
subplot(3,1,3)
plot(x,fs_bm,x,bm1,'LineWidth',2)
title('Bending Moment diagram')
xlabel('Length of Beam in mm')
ylabel('Bending Moment in kN-mm')
3. Matlab Code for Propped Cantilever Beam
% CLASS SAMPLE - CASE WORK SHOP
% Propped Cantilever Beam
- 3*L*x^2 +
%- Deflection
%- SFD
%- BMD
clear all
clc
fprintf('
fprintf('
fprintf('\n')
|
PROPPED CANTILEVER
|\n')
-----------------------------------\n ')
% A = input('type a value')
% Dimensions of Beam
L = 3000; % Length
B = 300; % Breadth
D = 300; % Depth
% Material Properties
GC = 20;
% Grade of Concrete
% Loading Conditions
PL = 20; % In kN
UDL = 20; % In kN
% Boundary Conditions
% ?????????????
% Claculations
E = 5000 * sqrt(GC);
I = (B*(D^3))/12 ;
i=0;
for x=0:0.2:L
i=i+1;
% Simply Supported
df(i) = ((UDL*x)/(24*E*I))*((L^3) - 2*L*(x^2) +
x^3);
df1(i)=0;
sf(i) = UDL*((L/2) - x);
sf1(i)=0;
bm(i) = ((UDL * x)/2)*(L-x);
bm1(i)=0;
% Cantilever with UDL
c_df(i) = (UDL/(24*E*I))*(x^4 - 4*L^3*x +
3*L^4);
c_sf(i) = UDL*x;
c_bm(i) = (UDL*x^2)/2 ;
% Cantilever with point load at the end
c_pl_df(i)= (PL/(6*E*I))*(2*(L^3) - 3*(L^2)*x +
(x^3));
c_pl_sf(i)= PL;
c_pl_bm(i)= PL*x;
% Cantilever with point load at any point
end
% Plotting the results
- 3*L*x^2 +
x=0:0.2:L;
subplot(3,1,1)
plot(x,fs_df,x,df1,'LineWidth',2)
hold on
plot(0,0,'b->','LineWidth',1,...
'MarkerEdgeColor','r',...
'MarkerFaceColor','g',...
'MarkerSize',12)
title('Deflection')
xlabel('Length of Beam in mm')
ylabel('Deflection in mm')
subplot(3,1,2)
plot(x,fs_sf,x,sf1,'LineWidth',2)
title('Shear force diagram')
xlabel('Length of Beam in mm')
ylabel('Shear force in kN')
subplot(3,1,3)
plot(x,fs_bm,x,bm1,'LineWidth',2)
title('Bending Moment diagram')
xlabel('Length of Beam in mm')
ylabel('Bending Moment in kN-mm')