MATLAB: Exponential element wise multiplication in matrix

element-wisematrixmatrix array

How do I perform element-wise multiplication for vector X (size n x 1) with each polynomial features, p such as X_p(i) = [X(i) X(i).^2 X(i).^3 … X(i).^p], where i is each row of X, so that the result will return with a matrix of size (n x p)

Best Answer

bsxfun(@power, X, 1:p)
Related Question