%% 2-D Grid
% Create 2-D grid coordinates with x-coordinates defined by the vector x and y-coordinates defined by the vector y.

x = 1:3;
y = 1:5;
[X,Y] = meshgrid(x,y)

%
% Evaluate the expression x^2 + y^2 over the 2-D grid.

X.^2 + Y.^2

% Copyright 2012 The MathWorks, Inc.