MATLAB: How to vectrorized this code

control systemMATLAB

close all
clear all
clc
tic;
i=1;
for k=1:1:10;
for a=1:1:10;
nump(i,:) =k*a;
denp(i,:) =[1 a 0];
i=i+1;
end
end

Best Answer

nump = (1:10) .* (1:10).'; % Auto-Expand >= Matlab R2016b
For older Matlab versions:
nump = bsxfun(@times, (1:10), (1:10).');
denp from KL's solution is perfect already. This is 2 microseconds(!) faster on my computer, but less nice:
denp = zeros(100, 3);
denp(:, 1) = 1;
denp(:, 2) = repmat((1:10)', 10, 1);