What is the meaning of this line?
Show older comments
Hello
I want to know why we are using the line
sumX2=sumX2+(listOfPoints(1,i)-Xc(1,:))^2;
Why 2 times sumX2, and what is the purpose of using 2 times, and can anyone let me know?
What are the changes in the result ?
sumX2=0; sumY2 =0; sumZ2=0; sumXY=0; sumYZ=0; sumXZ=0;
for i=1:N
sumX2 = sumX2 + (listOfPoints(1,i)-Xc(1,:))^2;
sumY2 = sumY2 + (listOfPoints(2,i)-Xc(2,:))^2;
sumZ2 = sumZ2 + (listOfPoints(3,i)-Xc(3,:))^2;
sumXY = sumXY + (listOfPoints(1,i)-Xc(1,:))*(listOfPoints(2,i)-Xc(2,:));
sumYZ = sumYZ + (listOfPoints(2,i)-Xc(2,:))*(listOfPoints(3,i)-Xc(3,:));
sumXZ = sumXZ + (listOfPoints(1,i)-Xc(1,:))*(listOfPoints(3,i)-Xc(3,:));
end
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!