MATLAB: How to do a matrix like this?

MATLABmatrix

how to do a matrix like this in a loop,[1 2 3 … 10,
1 4 9 … 100
1 8 27… 100]

Best Answer

(1:10).^((1:3)')
or on older MATLAB
bsxfun(@power,1:10,(1:3)')
Related Question