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

조회 수: 4 (최근 30일)
Andrew
Andrew 2011년 10월 29일
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!

채택된 답변

Amith Kamath
Amith Kamath 2011년 10월 30일
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
Andrew
Andrew 2011년 10월 30일
and that seems to do it...another overthinking of the problem on my part it seems. Thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by