Torsten
Posts:
1,698
Registered:
11/8/10


Re: 'for' loop to matrix operation
Posted:
Mar 25, 2014 8:10 AM


maxwell <refetalony@gmail.com> wrote in message <245609f8a2a646a0a3851ee9566cfd46@googlegroups.com>... > hi > how to write the follow loop in matrix term? > > for i = 1:size(A,1) > for j = 1:size(A,2) > B(i,j) = A(i,i) * A(j,j); > end > end
B=a'*a where a=[A_11 A_22 A_33 ... A_nn], the diagonal of the square matrix A.
Best wishes Torsten.

