In: Mechanical Engineering
Matlab assignment.
The objectives of this project are (1) to introduce the students to scripting applied to solution of mechanical engineering problems and (2) to create a Matlab script that allows the computation of principal stresses and strains starting from a generic state of stress and that automates the drawing of 3D Mohr circles
Assignment
1) Read from input a stress tensor (3D);
2) For any state of 3D stress compute the principal stress values (σ1, σ2, σ3) with σ1 > σ2 > σ3;
3) Calculate the maximum shear stress (radius of the three circles);
4) Draws the correspondent Mohr circles;
5) Given the principal stresses (computed at point 2) use the Hooke’s law to calculate the correspondent principal strains;
6) Create a flowchart correspondent to this code (Points 1 to 5).
function []=mohrs(StressState, option, angle) %MOHRS Draws a Mohr's circle. % MOHRS([SIGMAX,SIGMAY,TAUXY],OPTION,ANGLE) Calculates principle stresses, % maximum shear, and normal and shear stress on a requested plane. All of % these are presented graphically on a Mohr's circle diagram that can be % easily printed out. % % SIGMAX: Normal stress in the X direction. % SIGMAY: Normal stress in the Y direction. % TAUXY: Shear on the X-Y plane. % Together these three are gathered as the STRESSSTATE.
sx=StressState(1); sy=StressState(2); txy=StressState(3); center=mean([sx,sy]); [PrincipleStresses, IPShearMax, ShearMax]=pristress(StressState, option); PP=ppstress(StressState)'; radius=IPShearMax; clf showcirc(radius,[center,0],'r'); hold on showcirc(PrincipleStresses(1)/2,[PrincipleStresses(1)/2,0],'r--'); showcirc(PrincipleStresses(2)/2,[PrincipleStresses(2)/2,0],'r--'); showcirc(PrincipleStresses(3)/2,[PrincipleStresses(3)/2,0],'r--'); axis ('equal') edges=axis; le=edges(1); hs=(edges(2)-edges(1))/2; plot ([edges(1)-0.1*edges(1) edges(2)+0.1*edges(2)],[0 0],'b') plot ([0,0],[edges(3) edges(4)],'b') plot (center,0,'ro') plot ([sx,sy],[-txy,txy],'k') colA=strvcat('Center:','Maximum In Plane Shear:','Maximum Total Shear:'); colA=strvcat(colA,'Principle Stresses:','Principle Planes:'); colB=strvcat(num2str(center,4),num2str(IPShearMax,4),num2str(ShearMax,4)); colB=strvcat(colB,num2str(PrincipleStresses,4),num2str(RD(PP),4)); if nargin==3 AngleToHorPlane=atan2(txy,(sy-center)); AngleToRequestPlane=AngleToHorPlane + 2*angle; rn=center + radius * cos(AngleToRequestPlane); rs=radius * sin(AngleToRequestPlane); plot ([center,rn],[0,rs],'r',rn,rs,'rd') colA=strvcat(colA,'At angle:','**Normal Stress:','**Shear Stress:'); colB=strvcat(colB,num2str(RD(angle),4),num2str(rn,4),num2str(rs,4)); end axis ('equal') colA=strvcat(colA,'Negative shear causes CCW rotation of element.'); colB=strvcat(colB,' '); expandaxis (30, 30) titleblock(colA,colB); xlabel ('Normal Stress') ylabel ('Shear Stress') title (strcat('Mohrs circle: ',option)) text (sx,-txy,'V') text (sy,txy,'H') hold off