function strangpl(Sigma_x,Sigma_y,Tau_xy, ...
Angle,Sigma_ang0,Sigma_ang90,Tau_ang)
%----------------------------------------------
%
% strangpl(Sigma_x,Sigma_y,Tau_xy, ...
% Angle,Sigma_ang0,Sigma_ang90,Tau_ang)
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% This function plots the element and the
% stresses on a rotated element.
%
% Sigma_x - sigma in the x direction
% Sigma_y - sigma in the y direction
% Tau_xy - tau in the xy plane
% Angle - angle to stress plane (degs)
% Sigma_ang0 - sigma at Angle
% Sigma_ang90 - sigma at Angle+90degs
% Tau_ang - tau at Angle
%
% NOTE: To make the plotting perform
% as desired an undocumented MATLAB
% capability has been used (Renderlimits).
% MathWorks does not promise that it
% will be supported in the future.
% Renderlimits allows the two side-by-
% side plots to maintain the same
% y-axes. (no longer applicable!)
%
% User m functions called: arrows
%----------------------------------------------
degrad=pi/180; pi2=pi/2;
%...Define a unit square for element
Element=[-1 -1; 1 -1; 1 1; -1 1; -1 -1];
Raxis=[0 0;1 0];
%...................
%...Original element
%...................
%...Arrowhead direction
dirSx=sign(Sigma_x); dirSy=sign(Sigma_y);
dirTxy=sign(Tau_xy);
clf; ax=subplot(1,2,1);
plot(Element(:,1),Element(:,2),'-');
hold on;
plot(Raxis(:,1),Raxis(:,2),':');
if Sigma_x ~= 0
arrows(dirSx,0,0,Sigma_x,0,0,1,0);
arrows(dirSx,0,pi,0,0,0,0,0);
end
if Sigma_y ~= 0
arrows(dirSy,0,pi2,0,0,0,0,0);
arrows(dirSy,0,-pi2,0,Sigma_y,0,2,0);
end
if Tau_xy ~= 0
arrows(-dirTxy,-1,0,0,0,Tau_xy,3,Element);
arrows(-dirTxy,-1,pi,0,0,0,0,0);
arrows(dirTxy,-1,pi2,0,0,0,0,0);
arrows(dirTxy,-1,-pi2,0,0,0,0,0);
end
title('Original Element');
axis('equal'); axis('off');
hold off; drawnow;
% Rlimits=get(ax,'RenderLimits')
%...............
%...Stress plane
%...............
angle=Angle*degrad;
S1=Sigma_ang0; S2=Sigma_ang90;
T=Tau_ang;
str1=['Stresses at angle = ', ...
num2str(Angle),' degs'];
%...Arrowhead direction
dirSx=sign(Sigma_ang0); dirSy=sign(Sigma_ang90);
dirTxy=sign(Tau_xy);
%...Rotate by angle
trans=[cos(angle) -sin(angle);
sin(angle) cos(angle)];
temp=trans*Element'; Elementt=temp';
temp=trans*Raxis'; Raxist=temp';
subplot(1,2,2);
plot(Elementt(:,1),Elementt(:,2),'-');
hold on;
plot(Raxist(:,1),Raxist(:,2),':');
if S1 ~= 0
arrows(dirSx,0,angle,S1,0,0,1,0);
arrows(dirSx,0,pi+angle,0,0,0,0,0);
end
if S2 ~= 0
arrows(dirSy,0,pi2+angle,0,0,0,0,0);
arrows(dirSy,0,-pi2+angle,0,S2,0,2,0);
end
if T ~= 0
arrows(-dirTxy,-1,angle,0,0,0,0,0);
arrows(-dirTxy,-1,pi+angle,0,0,T,3, ...
Elementt);
arrows(dirTxy,-1,pi2+angle,0,0,0,0,0);
arrows(dirTxy,-1,-pi2+angle,0,0,0,0,0);
end
title(str1); axis('off');
set(gca,'DataAspectRatio',[1 1 1]);
hold off; drawnow;