%% Function name % stress_gtol %% Revised: % 16 January 2014 %% Author % Abigail Lambert, Trey Moore, & Autar Kaw % Section: All % Semester: Fall 2012 %% Purpose % Given the global stresses and the angle of the ply for a unidirectional % lamina, output the local stresses %% Usage % function [stress_loc] = stress_gtol(stress_glo,angle) % Input variables % stress_glo=vector of global stress applied to unidirectional lamina % [stress_glo]=[sx;sy;sxy] % sx=longitudinal global stress % sy=transverse global stress % sxy=in-plane global stress % angle=angle of ply in degrees % Output variables % stress_loc=vector of local stress applied to unidirectional lamina % [stress_loc]=[s1;s2;s12] % 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_glo]=[1.2; 3.6; .023]; fprintf('\nLongitudinal Global Stress: %g ',stress_glo(1)) fprintf('\nTransverse Global Stress: %g ',stress_glo(2)) fprintf('\nIn-Plane Global Stress: %g \n\n\n',stress_glo(3)) %% Test 1 % Testing for individual angle % Input desired angle in degrees angle=60; % Call function: stress_gtol [stress_loc] = stress_gtol(stress_glo,angle); % Results for a particular angle fprintf('\n\nAngle of Lamina: %G\n\n',angle) disp(' Local Stress for Lamina') disp('_________________________________') fprintf('\n s1 | %G\n s2 | %G\n s12 | %G\n\n\n\n',... stress_loc(1),stress_loc(2),stress_loc(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_loc] = stress_gtol(stress_glo,angle(i)); s1(i)=stress_loc(1); s2(i)=stress_loc(2); s12(i)=stress_loc(3); end disp(' Local Stress for Lamina') disp('__________________________________________________________________________') disp(' angle s1 s2 s12 ') for i=1:5:91 fprintf('\t%2.0f |\t %E |\t %E |\t %E \n',angle(i),s1(i),s2(i),s12(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; [stress_loc] = stress_gtol(stress_glo,angle(i)); s1(i)=stress_loc(1); s2(i)=stress_loc(2); s12(i)=stress_loc(3); end hold on plot(angle,s1,'b','LineWidth',2) plot(angle,s2,'r','LineWidth',2) plot(angle,s12,'m','LineWidth',2) grid legend('s1','s2','s12') title('Local Stress vs. Fiber Angle') xlabel('Angle (degrees)') ylabel('Local Stress') hold off