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 Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by