Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

CL2014 MATLAB Programming

Lab work # 3

Title: Formulation to calculate flexural stress


Student Name: MUEEZ ASIM
Student ID: 21L-5510
Date of Submission: 20/10/22

Grading Rubrics
Exemplary Proficient Developing Beginning Novice
Statement Score
(5) (4) (3) (2) (1)
1 Output/ Results Able to produce Able to Able to get Hardly able to Not able to
(40%) a high quality produce a some results produce the get any
code with code with from the code without results
desired output desired program with instructor’s from the
results. output major help program
having mistakes(s). without
minor instructors
mistake(s) help in
every step
2 Coding Style/ Able to write Able to write Used some of Used marginal None of
formatting (20%): program in program in the mentioned formatting the
Ability to use excellent good coding formatting techniques in formatting
coding style style missing techniques in the program. techniques
necessary commands
fulfilling all the 1-2 the program. were used
at the start of the
mentioned mentioned in the
program, provide criterion. criterion. program.
appropriate
description of
function, write
comments and use
proper indentation.
3 Coding Able to write Able to write Able to write Struggling to The student
Performance efficient code fairly good correct code in identify and is not able
with code with hardcoding correct the to identify
(20%): appropriate some logical without any errors in the and correct
Ability to write error handlers. errors or error handler. codes without the errors
appropriate error missing error help. in his code.
handlers and efficient handlers.
code without
hardcoding and
errors.
4 Lab Management Able to finish Able to Able to finish Struggling to Unable to
(20%): coding finish most most of the finish the code finish the
Time management complete in all of the coding coding within without code
aspects within within given given time instructors without
content organization
given time time missing missing 3-4 help instructors
1-2 criteria criteria help in
every step

Attained Score

Page 1 of 4
…………………….Start of MATLAB Code……………………….

clc
clear
%tutorial no : 3
%calculating flexural stresses
l= 20 ; %length of beam
w= 2 ; %udl applied on beam
btf= 4 ; %width of top flange
ttf= 1 ; %thickness of top flange
h= 8 ; %total depth of section
hw= 7 ; %height of web
tw= 1 ; %thickness of web
td=ttf+hw; %total depth of section

%calculating maximum bending moment


M=(w*l^2)/2; %maximum bending moment in the beam

%calculation of distances of segmentes from centroid


af=btf*ttf ;%area of flange
aw=hw*tw;%area of web
df=(ttf/2)+hw; %distance of center of flange from bottom
dw=hw/2; %distance of center of web from bottom
c=((af*df)+(aw*dw))/(af+aw); %centroid of the section
cf=df-c; %distance of center of flange from centroid
cw=c-dw; %distance of center of web from centroid

%calculation of moment of inertia


If=((btf*ttf^3)/12)+(af*cf); %moment of inertia for flang
Iw=((tw*hw^3)/12)+(aw*cw); %moment of inertia for web
I=If+Iw; %total moment of inertia

%calculation of distance of centoid from top and bottom


x1=cf+(ttf/2); %distance from top to centroid
x2=c; %distance from bottom to centroid

% Now calculating Section Modulus.


St=I/x1 ; %This is Section Modulus for top.
Sb=I/x2 ; %This is Section Modulus for bottom.

%calculation of flexural stresses


y1=linspace(0,x1,10); %generating points for flexural stresses
y2=linspace(0,-x2,10); %generating points for flexural stresses
y=linspace(x1,-x2,20); %generating points for flexural stresses
f=(M*y)/I ;%flexural stresses

Page 2 of 4
%displaying results
disp ([' The Maximum Bending moment M = ' num2str(M) 'kipsft'])
disp ([' Centroid from top x1 = ' num2str(x1) 'inch'])
disp ([' Centroid from bottom x2 = ' num2str(x2) 'inch'])
disp ([' Moment of Inertia I = ' num2str(I) 'lb.sqin'])
disp ([' Section modulus from top St = ' num2str(St) 'in^3'])
disp ([' Section of modulus from bottom Sb = ' num2str(Sb) 'in^3'])
disp ([' different points y on the section = ' num2str(y) 'inch'])
disp ([' flexural stresses f = ' num2str(f) 'ksi'])

……………………….End of MATLAB Code……………………….

…………………….Start of Results……………………….
The Maximum Bending moment M = 400kipsft
Centroid from top x1 = 3.0455inch
Centroid from bottom x2 = 4.9545inch
Moment of Inertia I = 49.2803lb.sqin
Section modulus from top St = 16.1816in^3
Section of modulus from bottom Sb = 9.9465in^3
different points y on the section = 3.0455 2.6244 2.2033 1.7823 1.3612
0.94019 0.51914 0.098086 -0.32297 -0.74402 -1.1651 -1.5861 -2.0072 -
2.4282 -2.8493 -3.2703 -3.6914 -4.1124 -4.5335 -4.9545inch
flexural stresses f = 24.7194 21.3018 17.8842 14.4666 11.049 7.63138
4.21376 0.796149 -2.62147 -6.03908 -9.45669 -12.8743 -16.2919 -19.7095
-23.1271 -26.5448 -29.9624 -33.38 -36.7976 -40.2152ksi
>>

……………………….End of Results……………………….

Page 3 of 4
Page 4 of 4

You might also like