%% Function name % strain_ltog %% Revised: % 21 January 2014 %% Author % Ahmad Hares, Trey Moore, & Autar Kaw % Section: All % Semester: Fall 2012 %% Purpose % Given the local strains and the angle of the ply for a unidirectional % lamina, output the global strains %% Usage % function [strain_glo] = strain_ltog(strain_loc,angle) % Input variables % strain_loc=vector of local strain applied to unidirectional lamina % [strain_loc]=[eps1;eps2;eps12] % eps1=longitudinal local strain % eps2=transverse local strain % eps12=in-plane local strain % angle=angle of ply in degrees % Output variables % strain_glo=vector of global strain applied to unidirectional lamina % [strain_glo]=[epsx;epsy;epsxy] % 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 [strain_loc]=[5.206E-5;7.841E-4;1.374E-3]; fprintf('\nLongitudinal Local Strain: %g ',strain_loc(1)) fprintf('\nTransverse Local Strain: %g ',strain_loc(2)) fprintf('\nIn-Plane Local Strain: %g \n\n\n',strain_loc(3)) %% Test 1 % Testing for individual angle % Input desired angle in degrees angle=60; % Call function: strain_ltog [strain_glo] = strain_ltog(strain_loc,angle); % Results for a particular angle fprintf('\n\nAngle of Lamina: %G\n\n',angle) disp(' Global Strains for Lamina') disp('_________________________________') fprintf('\n epsx | %G\n epsy | %G\n epsxy | %G\n\n\n\n',... strain_glo(1),strain_glo(2),strain_glo(3)) %% Test 2 % Table of Local Strains of an Angle Lamina % as a Function of Fiber Angle for i=1:5:91 angle(i)=i-1; [strain_glo] = strain_ltog(strain_loc,angle(i)); epsx(i)=strain_glo(1); epsy(i)=strain_glo(2); epsxy(i)=strain_glo(3); end disp(' Global Strains for Lamina') disp('______________________________________________________') disp(' angle epsx epsy epsxy ') for i=1:5:91 fprintf('\t%3.0f |\t %7.4f |\t %7.4f |\t %7.4f \n',angle(i),epsx(i),epsy(i),epsxy(i)) end %% Test 3 % Graph of Local Strains of an Angle Lamina % as a Function of Fiber Angle for i=1:1:91 angle(i)=i-1; [strain_glo] = strain_ltog(strain_loc,angle(i)); epsx(i)=strain_glo(1); epsy(i)=strain_glo(2); epsxy(i)=strain_glo(3); end hold on plot(angle,epsx,'b','LineWidth',2) plot(angle,epsy,'r','LineWidth',2) plot(angle,epsxy,'m','LineWidth',2) grid legend('epsx','epsy','epsxy') title('Global Strains vs. Fiber Angle') xlabel('Angle (degrees)') ylabel('Global Strains') hold off