%  Day 5 Example Problem

%  Two dimensional state of stress


sigma = [  80  40  0
            40  50  0
             0   0  0 ]
         

 %  Calculation of Principal Stresses MC
 
 C = (sigma(1,1) + sigma(2,2) )/2
 R = sqrt(((sigma(1,1)-sigma(2,2))/2)^2+sigma(1,2)^2)
 
 s1 = C+R
 s2 = C-R
 s3 = 0
 taumax = (max([s1,s2,s3])-min([s1,s2,s3]))/2
 
 
 %  Use  stress transformations and eigens.
 
 [V,D]=eigs(sigma);
 
%  Here I'm assuming largest principal stress is the first.
%  And second principal stress is next.  What we need is a
%  rotation about the direction of the middle principal
% stress.

a = sqrt(2)/2;
R = [ a 0 -a; 0 1 0; a 0 a];

sig_tau_max = R' * D * R