The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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 ]

Posts: 1,717
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 <> wrote in message <>...
> 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

where a=[A_11 A_22 A_33 ... A_nn], the diagonal of the square matrix A.

Best wishes

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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.