x = 0:3;
y = 0:2:8;

% Calculate z = x + y using nested for-loops.
for i = 1:length(x)
	for j = 1:length(y)
		z(i,j) = x(i) + y(j);
	end
end

% Calculate z = x + y using meshgrid.
[xx,yy] = meshgrid(x,y);
zz = xx + yy;