Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: 'for' loop to matrix operation
Replies: 4   Last Post: Mar 25, 2014 9:57 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Torsten

Posts: 1,449
Registered: 11/8/10
Re: 'for' loop to matrix operation
Posted: Mar 25, 2014 8:10 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

maxwell <refetalony@gmail.com> wrote in message <245609f8-a2a6-46a0-a385-1ee9566cfd46@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.



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.