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: How to improve this with Matlab vectors
Replies: 4   Last Post: Oct 14, 2011 2:16 PM

Advanced Search

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

Posts: 113
Registered: 11/22/09
Re: How to improve this with Matlab vectors
Posted: Oct 14, 2011 5:26 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Good. Thanks.

Now, for a different class, I need to raise the numbers 0 though N-1 to successive powers, 1 through N. Like this:

0 0 0 ...
1 1 1 1 ....
2 4 8 16 ....
3 9 27 81 ...
N-1^1 N-1^2 ...

I tried starting with vertical vector (0:N-1)'. But how do I make each column raised to the next power?

I tried
(0:N-1)'.^(0:N-1) does not work

I could just write a loop, but that seems so inelegant.

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.