0% found this document useful (0 votes)
42 views6 pages

Samlpe Codes

The document contains 3 sections of MATLAB code that analyze different types of beams: 1) A simply supported beam with calculations for deflection, shear force, and bending moment. 2) A propped cantilever beam with the same calculations shown for different beam configurations. 3) Plotting functions to display the results of the calculations.

Uploaded by

Ramesh Sinde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views6 pages

Samlpe Codes

The document contains 3 sections of MATLAB code that analyze different types of beams: 1) A simply supported beam with calculations for deflection, shear force, and bending moment. 2) A propped cantilever beam with the same calculations shown for different beam configurations. 3) Plotting functions to display the results of the calculations.

Uploaded by

Ramesh Sinde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Sample Codes done in Lectures1-4

1. Matlab Code for Plots


clear all
clc
x=-10:1:10
y=x;
x1=-3.16:0.2:3.16;
y1=x.^2;
y2=x.^3;
y3=x.^4;
step(x,y)
title('Linear')
xlabel('x-axis')
ylabel('y-axis')

2. Matlab Code for Single Span Beam


% CLASS SAMPLE - CASE WORK SHOP
% SINGLE SPAN BEAMS
%- Deflection
%- SFD
%- BMD
clear all
clc
fprintf('
fprintf('
fprintf('\n')

|
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

% 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

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

You might also like