% Matlab script to solve Example 2.1.1 tau = [-40, -10; -10, -60]; % stress tensor nhat = [1/sqrt(2); 1/sqrt(2)] % fault normal unit vector trac = tau * nhat % traction across fault trac_norm = dot(trac, nhat) % normal stress on fault fhat = [1/sqrt(2); -1/sqrt(2)] % fault parallel unit vector trac_shear = dot(trac, fhat) % shear stress on fault % Matlab script to solve Example 2.1.3 tau = [-40, -10; -10, -60]; [N, Lam] = eig(tau) % gives eigenvectors as columns of N, eigenvalues on diagonal of Lam angle = atan(N(2,1)/N(1,1))*180/pi % compute angle of 1st eigenvector wrt x-axis and convert to degrees taur = N' * tau * N % compute rotated stress tensor