I've been trying to figure out for half a day why my Solution was not 0 by an order of 1.0e-14 or e-15. When I added several matrices together I noticed that the order to which I add them changes the value. Sol_1=0 (3X3) Matrix but Sol_2=~0(3X3). Please help, I can't figure it out.
clearE1=80.32E2=5.590v12=0.338G12=3.590Composite_Properties=[E1 E2 v12 G12 0 0.254; E1 E2 v12 G12 -45 0.254; E1 E2 v12 G12 45 0.254; E1 E2 v12 G12 45 0.254; E1 E2 v12 G12 -45 0.254; E1 E2 v12 G12 0 0.254][r,c]=size(Composite_Properties) A=cell(1,r)for i = 1:r A{i}=Q_BAR(Composite_Properties(i,1),Composite_Properties(i,2),Composite_Properties(i,3),Composite_Properties(i,4),Composite_Properties(i,5))*Composite_Properties(i,6)endA_SUM=A{1};for i=2:(c) A_SUM=A_SUM+A{i};end A_SUM z_k_bar=zeros(1,r,'double') for j=1:r z_k_bar(j)=(((-r/2)+((2*j-1)/2))*Composite_Properties(j,6)) endclear i j %Making B Matices
B=cell(1,r)for i = 1:rB{i}=Q_BAR(Composite_Properties(i,1),Composite_Properties(i,2),Composite_Properties(i,3),Composite_Properties(i,4),Composite_Properties(i,5))*z_k_bar(1,i)*Composite_Properties(i,6)end%Summation of B Matrices
B_SUM=B{1}for j=2:cB_SUM=B_SUM + B{j};endB_SUMSol_1=B{1}+B{6}+B{2}+B{5}+B{3}+B{4} %0 Matrix%
Sol_2=B{1}+B{2}+B{3}+B{4}+B{5}+B{6} %not Zero why???%
Best Answer