%% Function name % strainglocallaminate %% Revised: % 3 February 2014 %% Author % Necip Kayim, Trey Moore, & Autar Kaw % Section: All % Semester: Fall 2013 %% Purpose % Given the number of plies, angle of each ply, as well as the global % strains, output the local strains at the top, middle, and bottom of % each laminate %% Usage % function [strainlocalplies] = strainlocallaminate(strainglobalplies,angleplies,nplies) % Input variables % strainglobalplies=global strains at top, middle, and bottom of each laminate % angleplies=the angle of each ply in degrees % nplies=number of plies % Output variables % strainlocalplies=local strains at top, middle, and bottom of each laminate % Keyword % local strain matrix % global strain matrix % transformation of strains %% License Agreement % http://www.eng.usf.edu/~kaw/OCW/composites/license/limiteduse.pdf %% Testing code clc clear all %% Inputs strainglobalplies(:,:,1)=[8.944E-8 5.955E-6 -3.836E-6;1.637E-7 5.134E-6 -2.811E-6;2.380E-7 4.313E-6 -1.785E-6;]; strainglobalplies(:,:,2)=[2.380E-7 4.313E-6 -1.785E-6;3.123E-7 3.492E-6 -7.598E-7;3.866E-7 2.670E-6 2.655*10^-7]; strainglobalplies(:,:,3)=[3.866E-7 2.670E-6 2.655E-7;4.609E-7 1.849E-6 1.291E-6;5.352E-7 1.028E-6 2.316E-6]; angleplies=[0 30 -45]; nplies=3; fprintf('Number of plies: %g\n',nplies) for k=1:1:nplies fprintf('\nFor Ply: %g\n',k) disp('___________________________________________') fprintf('\n Angle of Ply: %g\n',angleplies(k)) 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(' Epsx | %G\n',strainglobalplies(i,j,k)) end if y==2 fprintf(' Epsx | %G\n',strainglobalplies(i,j,k)) end if y==3 fprintf(' Gammaxy | %G\n',strainglobalplies(i,j,k)) end end end end %% Test % Call function: strainlocalplies strainlocalplies = strainlocallaminate(strainglobalplies,angleplies,nplies); for k=1:1:nplies fprintf('\n\nFor Ply: %g\n\n',k) 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(' Eps1 | %G\n',strainlocalplies(i,j,k)) end if y==2 fprintf(' Eps2 | %G\n',strainlocalplies(i,j,k)) end if y==3 fprintf(' Gamma12 | %G\n',strainlocalplies(i,j,k)) end end end end