%  Stress Transformations

%  Here is a transformation matrix, which corresponds to
%  a rotation in the xy plane of angle theta.

theta = 30*pi/180;

Q = [  cos(theta)  -sin(theta)   0
       sin(theta)   cos(theta)   0
                0            0   1 ]
            

%  Here is a stress tensor, plane stress.

sigma = [  10   6   0
            6  -6   0
            0   0   0 ]
        

%  Here is the transformed stress tensor.

sigma_p = Q' * sigma * Q


%  Check using Mohr's Circle

C = 2;
R = 10;
a1 = atan(.75);
a2 = pi/3;
phi = a2-a1;
sxp = C + R*cos(phi)
syp = C - R*cos(phi)
txyp = -R*sin(phi)
     