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: 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 ]
Jeff

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
((0:N-1)')^(0:N-1)

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




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.