%% Function name % stresslocallaminate %% Revised % 3 February 2014 %% Authors % Prashanth Sridharan, Trey Moore, & Autar Kaw % Section: All % Semester: Fall 2013 %% Purpose % Given the number of angle plies, the angle of each ply, and the % global stress of each of the plies, output the global stresses for each ply %% Usage % function [stresslocalplies] = stresslocallaminate(stressglobalplies,angleplies,nplies) % Input variables % stressglobalplies=global stress at top, middle, and bottom of each laminate % nplies=number of plies % angleplies=angle of each ply % Output variables % stresslocalplies=local stress at top, middle, and bottom of each laminate % Keyword % global strain % global stress %% License Agreement % http://www.eng.usf.edu/~kaw/OCW/composites/license/limiteduse.pdf %% Testing code clear all clc %% Inputs % Lamina: 0/30/-45 stressglobalplies(:,:,1)=[33510 61880 -27500; 44640 53590 -20150;55770 45310 -12800]; stressglobalplies(:,:,2)=[69300 73910 33810; 106300 77470 59030;143400 81020 84260]; stressglobalplies(:,:,3)=[123500 156300 -118700; 49030 68940 -38880;-25470 -18400 40910]; nplies=3; angleplies=[0 30 -45]; fprintf('Number of plies: %g\n',nplies) for k=1:1:nplies fprintf('\n\nFor Ply: %g\n\n',k) disp(' Global Stress') disp('___________________________________________') for i=1:1:3 x=i; if x==1 disp(' Top') end if x==2 disp(' Middle') end if x==3 disp(' Bottom') end for j=1:1:3 y=j; if y==1 fprintf(' Sx | %G\n',stressglobalplies(i,j,k)) end if y==2 fprintf(' Sx | %G\n',stressglobalplies(i,j,k)) end if y==3 fprintf(' Txy | %G\n',stressglobalplies(i,j,k)) end end end end %% Test % Call function: stresslocalplies stresslocalplies = stresslocallaminate(stressglobalplies,angleplies,nplies); for k=1:1:nplies fprintf('\n\nFor Ply: %g\n\n',k) disp(' Local Stresses') disp('___________________________________________') for i=1:1:3 x=i; if x==1 disp(' Top') end if x==2 disp(' Middle') end if x==3 disp(' Bottom') end for j=1:1:3 y=j; if y==1 fprintf(' S1 | %G\n',stresslocalplies(i,j,k)) end if y==2 fprintf(' S2 | %G\n',stresslocalplies(i,j,k)) end if y==3 fprintf(' T12 | %G\n',stresslocalplies(i,j,k)) end end end end