How do I do a summation of n 6x6 matrices?
2 次查看(过去 30 天)
显示 更早的评论
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!
0 个评论
采纳的回答
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?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!