I have two vectors, X of bases and N of exponents. I want to get the matrix of all values e = xn for each x in
X
N
e = xn
x
Use bsxfun:
bsxfun(@power, X, N)
This assumes that X is a column vector and N is a row vector. If you want to guarantee that, use the following syntax which is more robust:
bsxfun(@power, X(:), N(:).')