How do I do a summation of n 6x6 matrices?

2 views (last 30 days)
OK, so I am trying to take data from the surface of an object and fit an ellipsoid to it (ref: A LOWER BOUND ON THE VARIANCE OF ALGEBRAIC ELLIPSOID-FITTING CENTER ESTIMATOR, Jai Li, 2006). This process requires me to do the following type of procedure for matrices:
S = summation(i=1 to n) transpose(mi1)*mi1
where mi1 is a 1x6 matrix with numerical data.
Thus, if I just call my data from an excel sheet and say something like:
for i=1:370
mi1 = [x2(i) y2(i) z2(i) xy(i) xz(i) yz(i)];
S11 = transpose(mi1)*mi1;
end
then I am just going to end up getting 370 6x6 matrices. If I say:
S11 = sum(transpose(mi1)*mi1);
then I just get the sum of the rows for each of the 370 matrices.
I want my end result to be a single 6x6 matrix that follows the form originally stated by the summation:
S = summation(i=1 to n) transpose(mi1)*mi1
I'm a little stuck with this and any help would be greatly appreciated!

Accepted Answer

Amith Kamath
Amith Kamath on 30 Oct 2011
From the description that you've given, I suppose you need to initialize S11 to zeros(6,6) and then in the loop, iterate as:
S11 = S11 + transpose(mi1)*mi1;
which is going to add the contents of the 6x6 matrix in the way you want. Am I getting this right?
  1 Comment
Andrew
Andrew on 30 Oct 2011
and that seems to do it...another overthinking of the problem on my part it seems. Thanks!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!