Hey guys, this is a snippet of my code I can't seem to get to graph. S is a 3×3 matrix and I need to plot points (1,1), (2,2) and (3,3) of the transformed 3×3 Sxy matrix for values of theta from 0:90. How to I get the figures to work and not just be blank? I would very much appreciate help with this. So far I've tried using the 'hold on' and moving the plot functions inside the for loop.
I would do this without the for loop but the matrix S does not change with each iteration so without the for loop, the inner matrix indices do not match.
for theta=0:90 % Angles
c=cosd(theta); s=sind(theta); % Transformation Matrix
T=[c.^2 s.^2 2.*c.*s; s.^2 c.^2 -2.*c.*s; -c.*s c.*s c.^2-s.^2]; Tinv=[c.^2 s.^2 -2.*c.*s; s.^2 c.^2 2.*c.*s; c.*s -c.*s c.^2-s.^2]; % Coordinate Transformations
Sxy=Tinv*S*T; Exx=1/Sxy(1,1); Eyy=1/Sxy(2,2); Gxy=(1/Sxy(3,3))/2; end figure(1)plot(theta,Exx) xlabel('Theta in Degrees')ylabel('Exx') figure(2)plot(theta,Eyy)xlabel('Theta in Degrees')ylabel('Eyy') figure(3)plot(theta,Gxy)xlabel('Theta in Degrees')ylabel('Gxy')
Best Answer