% Example: prstrex
% ~~~~~~~~~~~~~~~~
% This example determines the principal
% stresses for an element.
%
% Data is defined in the declaration statements
% below, where:
%
% No_angs - number of angles to calculate
% stress values for
% Sigma_x - normal stress on x-axis
% Sigma_y - normal stress on y-axis
% Tau_xy - shear stress
% Angle - angle (in degrees) to determine
% stresses for
%
% NOTES: 1) normal stresses are + for tension,
% - for compression
% 2) shear stresses are + when they
% are directed down on the positive
% x-axis face
%
% User m functions required:
% prstress, strangle, prplot, arrows,
% polarstr, genprint
%----------------------------------------------
clear;
%...Input definitions
Problem=2;
No_angs=90;
if Problem == 1
%...Hydrostatic case
Sigma_x=10; Sigma_y=10; Tau_xy=0;
elseif Problem == 2
%...Other
Sigma_x=70; Sigma_y=10; Tau_xy=40;
end
degrad=pi/180; raddeg=180/pi;
%...Find principal stresses
[Key,Smax,Smin,Savg,Tmxmn,Smax_ang, ...
Smin_ang,Tmax_ang,Tmin_ang]= ...
prstress(Sigma_x,Sigma_y,Tau_xy);
%...Find properties for rotated axes
theta=linspace(-180,180,No_angs+1);
for i=1:No_angs+1
[Sxtheta(i),Sytheta(i),Sxytheta(i)]= ...
strangle(theta(i),Sigma_x,Sigma_y,Tau_xy);
end
%...Output results
fprintf ...
('\n\nDetermination of Principal Stresses');
fprintf ...
('\n-----------------------------------\n');
fprintf('\n Sigma-x: %g',Sigma_x);
fprintf('\n Sigma-y: %g',Sigma_y);
fprintf('\n Tau-xy: %g\n',Tau_xy);
if Key == 1
fprintf('\n -----------------------------');
fprintf('\n ALL axes are principal axes');
fprintf('\n -----------------------------');
fprintf('\n Sigma-max: %g',Smax);
fprintf('\n Sigma-min: %g',Smin);
fprintf('\n Tau-max: %g',Tmxmn);
else
fprintf('\n Sigma-max: %g at %g', ...
Smax,Smax_ang);
fprintf('\n Sigma-min: %g at %g', ...
Smin,Smin_ang);
fprintf('\n Sigma-avg: %g at %g', ...
Savg,Tmax_ang);
fprintf('\n Tau-max: %g at %g', ...
Tmxmn,Tmax_ang);
fprintf('\n Tau-min: %g at %g', ...
-Tmxmn,Tmin_ang);
end
fprintf('\n\n');
%...Plot the results
prplot(Smax,Smin,Savg,Tmxmn,Smax_ang, ...
Tmax_ang,Sigma_x,Sigma_y,Tau_xy)
% genprint('prstress');
disp('Press a key to continue'); pause;
clf;
plot(theta,Sxtheta,'-',theta,Sytheta,'--', ...
theta,Sxytheta,':');
title('Transformation of Stress');
xlabel('Angle (degrees)');
ylabel('Stress');
h=legend(' Sx',' Sy',' Tau','Location','Best');
axes(h); drawnow;
% genprint('rotstr')
disp('Press a key to continue'); pause;
tit=['Polar Diagram for Transformation ', ...
'of Stress'];
theta=theta*degrad;
clf;
polarstr(theta,Sxtheta,'w-'); hold on;
polarstr(theta,Sytheta,'c--');
polarstr(theta,Sxytheta,'g-.');
title(tit); axis('equal'); axis('off');
h=legend(' Sx',' Sy',' Tau','Location','Best');
hold off; axes(h); drawnow;
% genprint('polar')