I understand that it not best practice to try and plot data extracted from a for loop statement, but I cannot think of another way to perform the matrix computation, seeing as matrix "x" is a matrix containing other matrices (i.e. S11bar, S12bar, S22bar, S16bar, S26bar, S66bar), and linear algebraic conditions cannot be satisfied for the matrix multiplication operation.
E1 = 161.3; E2 = 8.4; v12 = 0.32;G12 = 5.2; S11 = 1/E1;S22 = 1/E2;S12 = -v12/E1;S66 = 1/G12;A = [epsilon_xx; 0; gamma_xy];B = [-1; sigma_yy; 0];figure; hold onfor th = -90:15:90m = cosd(th);n = sind(th);S11bar = S11*m.^4+(2*S12+S66)*n.^2.*m.^2+S22*n.^4;S12bar = (S11+S22-S66)*n.^2.*m.^2+S12*(n.^4+m.^4);S22bar = S11*n.^4+(2*S12+S66)*n.^2.*m.^2+S22*m.^4;S16bar = (2*S11-2*S12-S66)*n.*m.^3+(2*S12-2*S22+S66)*n.^3.*m;S26bar = (2*S11-2*S12-S66)*n.^3.*m+(2*S12-2*S22+S66)*n.*m.^3;S66bar = 2*(2*S11+2*S22-4*S12-S66)*n.^2.*m.^2+S66*(n.^4+m.^4);x = [S11bar S12bar S16bar; S12bar S22bar S26bar; S16bar S26bar S66bar];matrixeqn = A == x*B;sol = solve(matrixeqn);v_sigma_yy = double(sol.sigma_yy);plot(th,v_sigma_yy,'-*','LineWidth',3);xlabel('\theta (degrees)');xticks([-90:45:90]);ylabel('${\sigma}_{yy}$','Interpreter','Latex');yticks('auto');set(gca,'FontSize',16);endhold off
Thanks for your help!
Best Answer