MATLAB: How to generate a matrix containing 35 rows and 3 columns

matrix arrayrows columns

I need to generate a matrix that has 35 rows and 3 columns. In the first column -17:17, second column -17:17 but generate the powers of 2. And in column 3 -17:17 but generate the powers of 3?.

Best Answer

bsxfun(@power,(-17:17).', 1:3)