%% Default Grid
% For many cases, when you are analyzing data, you care about both the distances between points in the grid and their value. For example, a data set might represent rainfall at specific points in a geographic area. In this case, you would care about the value at each grid point and the distance between a point and its neighbor. In other cases, you might care only about the value for a given point and not about the relative distances. For example, you could be working with input data from an MRI scan where the distance between the points is completely uniform. In this case, you would care about the values of the points, but you can be certain of a completely uniform grid. In this case, the default grid representation is useful. The default grid representation stores the value at a grid point explicitly and creates grid point coordinates implicitly.
% This example shows how you can use the default grid instead of the full grid to produce a plot.
% Create a grid and a function that you want to plot.

[X,Y] = meshgrid(11:15,11:16);
Z = X.^2 + Y.^2;

%
% Use the full grid that you created with meshgrid by using X and Y.

figure
surf(X,Y,Z)
title('Full Grid')

%
% In contrast, have MATLAB create a default grid instead of using the full grid.

figure
surf(Z)
title('Default Grid')

% Notice the difference in the scaling of the axes. When you plot the full grid the X- and Y-axis have ranges of 11 to 15 and 10 to 16 respectively. When you plot the default grid the X- and Y-axis have ranges of 1 to m and 1 to n, where Z is m-by-n.
% Copyright 2012 The MathWorks, Inc.