%% Function name % stress_ltog %% Revised: % 21 January 2014 %% Author % Casey McKenzie, Trey Moore, & Autar Kaw % Section: All % Semester: Fall 2012 %% Purpose % Given the local stresses and the angle of the ply for a unidirectional % lamina, output the global stresses %% Usage % function [stress_glo] = stress_ltog(stress_loc,angle) % Input variables % stress_loc=vector of local stress applied to unidirectional lamina % [stress_loc]=[s1;s2;s12] % s1=longitudinal local stress % s2=transverse local stress % s12=in-plane local stress % angle=angle of ply in degrees % Output variables % stress_glo=vector of global stress applied to unidirectional lamina % [stress_glo]=[sx;sy;sxy] % Keyword % local stress matrix % global stress matrix % transformation of stress %% License Agreement % http://www.eng.usf.edu/~kaw/OCW/composites/license/limiteduse.pdf %% Testing code clc clear all %% Inputs [stress_loc]=[1.714;-2.714;-4.165]; fprintf('\nLongitudinal Local Stress: %g ',stress_loc(1)) fprintf('\nTransverse Local Stress: %g ',stress_loc(2)) fprintf('\nIn-Plane Local Stress: %g \n\n\n',stress_loc(3)) %% Test 1 % Testing for individual angle % Input desired angle in degrees angle=60; % Call function: strain_ltog [stress_glo] = stress_ltog(stress_loc,angle); % Results for a particular angle fprintf('\n\nAngle of Lamina: %G\n\n',angle) disp(' Global Stress for Lamina') disp('_________________________________') fprintf('\n sx | %G\n sy | %G\n sxy | %G\n\n\n\n',... stress_glo(1),stress_glo(2),stress_glo(3)) %% Test 2 % Table of Local Stress of an Angle Lamina % as a Function of Fiber Angle for i=1:5:91 angle(i)=i-1; [stress_glo] = stress_ltog(stress_loc,angle(i)); sx(i)=stress_glo(1); sy(i)=stress_glo(2); sxy(i)=stress_glo(3); end disp(' Global Stress for Lamina') disp('______________________________________________________') disp(' angle sx sy sxy ') for i=1:5:91 fprintf('\t%3.0f |\t %7.4f |\t %7.4f |\t %7.4f \n',angle(i),sx(i),sy(i),sxy(i)) end %% Test 3 % Graph of Local Stress of an Angle Lamina % as a Function of Fiber Angle for i=1:1:91 angle(i)=i-1; [stress_glo] = stress_ltog(stress_loc,angle(i)); sx(i)=stress_glo(1); sy(i)=stress_glo(2); sxy(i)=stress_glo(3); end hold on plot(angle,sx,'b','LineWidth',2) plot(angle,sy,'r','LineWidth',2) plot(angle,sxy,'m','LineWidth',2) grid legend('sx','sy','sxy') title('Global Stress vs. Fiber Angle') xlabel('Angle (degrees)') ylabel('Global Stress') hold off