So, do you need different degrees of a, all drawn into a vector? I would create an array in which each column of the array is different from a. Then insert it into the vector. Something like that...
aNew = bsxfun(@power,a,1:T);
aNew = aNew(:);
It does what you want in a simple, effective way. bsxfun is a more efficient way of writing an extension than other methods like repmat, ndgrid and meshgrid.
The code I wrote assumes that a is the column vector as you built it.
user85109
source
share