2 Answers
2

So you want different powers of a, all strung out into a vector? I would create an array, where each column of the array is a different power of a. Then string it out into a vector. Something like this...

aNew = bsxfun(@power,a,1:T);
aNew = aNew(:);

This does what you want, in a simple, efficient way. bsxfun is a more efficient way of writing the expansion than are other methods, such as repmat, ndgrid and meshgrid.

The code I wrote does assume that a is a column vector, as you have constructed it.