Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Jeff
Posts:
113
Registered:
11/22/09


Re: How to improve this with Matlab vectors
Posted:
Oct 14, 2011 5:26 AM


Good. Thanks.
Now, for a different class, I need to raise the numbers 0 though N1 to successive powers, 1 through N. Like this:
0 0 0 ... 1 1 1 1 .... 2 4 8 16 .... 3 9 27 81 ... ... N1^1 N1^2 ...
I tried starting with vertical vector (0:N1)'. But how do I make each column raised to the next power?
I tried (0:N1)'.^(0:N1) does not work ((0:N1)')^(0:N1)
I could just write a loop, but that seems so inelegant. Thanks.



