%this Program Calculates Normal Stresses and Inclination of Neutral Axis %enter 1,2,3,4 For Rectangle, L Section, I Section and Z Section
%this Program Calculates Normal Stresses and Inclination of Neutral Axis %enter 1,2,3,4 For Rectangle, L Section, I Section and Z Section
clear
%This program calculates Normal Stresses and Inclination of Neutral
Axis
%Enter 1,2,3,4 for rectangle, L Section, I Section and Z Section
X=input('Enter Desired cross-section no.');
My=input('Enter Moment along y-axis. ');
Mz=input('Enter Moment along z-axis.');
Y=input('Enter Y-Coordinate of Point.');
Z=input('Enter Z-coordinate to y-axis.' ) ;
if X==1
b1=input('Enter length parallel to Z-axis.') ;
b2=input('Enter length parallel to Y-axis.') ;
h1=input('Enter length perpendicular to Z-AXIS.' );
h2=input('Enter length perpendicular to Y-AXIS.' );
Iy=(b2*(h2^3))/12
Iz=(b1*(h1^3))/12
Sigmax=((My*Z)/Iy)-((Mz*Y))/Iz
Alpha=atand((My*Iz)/(Mz*Iy))
elseif X==2
b3=input('Enter length parallel to y-axis of Vertical leg.');
h3=input('Enter length Perpendicular to y-axis of Vertical leg.');
b4=input('Enter length parallel to z-axis of Horizontal Leg.');
h4=input('Enter length perpendicular to z-axis of Horizontal
leg.');
d1=input('Enter distance between y-axes of Vertical leg and
CentroidalAxis with proper sign convention.');
d2=input('Enter distance between z-axes of Vertical leg and
CentroidalAxis with proper sign.');
d3=input('Enter distance between y-axes of horizontal leg and
CentroidalAxis with proper sign.');
d4=input('Enter distance between z-axes of horizontal leg and
CentroidalAxis with proper sign.');
A1=input('Enter Area of vertical leg.') ;
A2=input('Enter Area of Horizontal leg.') ;
Iy=(((b3*(h3)^3)/12))+A1*(d1^2)+(((h4*(b4)^3)/12))+A2*(d3^2)
Iz=(((h3*(b3)^3)/12))+A1*(d2^2)+(((b4*(h4)^3)/12))+A2*(d4^2)
Iyz=(A1*d1*d2)+(A2*d3*d4)
SigmaX=(Z*(Mz*Iyz+My*Iz)-Y*(My*Iyz+Mz*Iy))/((Iy*Iz)-(Iyz^2))
Alpha=atand((Mz*Iyz+My*Iz)/(My*Iyz+Mz*Iy))
elseif X==3
b5=input('Enter total length parallel to y-axis.') ;
h5=input('Enter total length parallel to z-axis.') ;
b6=input('Enter smaller length parallel to y-axis.') ;
h6=input('Enter smaller length parallel to z-axis.') ;
Iy=((b5*(h5^3)/12))-(2*(b6*(h6^3)/12))
Iz=((h5*(b5^3)/12))-(2*(h6*(b6^3)/12))
Sigmax=(My*Z/Iy)-(Mz*Y/Iz)
Alpha=atand((My*Iz)/(Mz*Iy))
elseif X==4
b7=input('Enter length parallel to y axis of 1st Vertical leg');
1
h7=input('Enter length perpendicular to y axis of 1st Vertical
leg');
b8=input('Enter length parallel to z axis of Horizontal part');
h8=input('Enter length perpendicular to the z axis of horizontal
part');
b9=input('Enter length parallel to y axis of second vertical
part');
h9=input('Enter length perpendicular to y axis of second vertical
part');
d5=input('Enter Distance b/w y axis of 1st vertical part and
centroidal axis with sign convention');
d6=input('Enter Distance b/w z axis of 1st vertical part and
centroidal axis with convention sign');
d7=input('Enter Distance b/w y axis of 2nd vertical part and
centroidal axis with convention sign');
d8=input('Enter Distance b/w z axis of 2nd vertical part and
centroidal axis with convention sign');
A3=input('Enter Area of 1st Vertical leg');
A4=input('Enter Area of Horizontal part');
A5=input('Enter Area of 2nd Vertical leg');
Iy=(((b7*(h7)^3)/12))+A3*(d5^2)+(((h8*(b8)^3)/12))+(((b9*(h9)^3)/12))+A5*(d7^2)
Iz=(((h7*(b7)^3)/12))+A3*(d6^2)+(((b8*(h8)^3)/12))+(((h9*(b9)^3)/12))+A5*(d8^2)
Iyz=A3*d5*d6+A5*d7*d8
SigmaX=(Z*(Mz*Iyz+My*Iz)-Y*(My*Iyz+Mz*Iy))/((Iy*Iz)-(Iyz^2))
Alpha=atand((Mz*Iyz+My*Iz)/(My*Iyz+Mz*Iy))
end