%% Interpolation with Default Grid
% Use the default grid to perform a quick interpolation on a set of sample points. The default grid uses unit-spaced points, so this interpolation is useful when the exact xy spacing between the sample points is not important.
%
% Create a matrix of sample function values and plot them against the default grid.

x = (1:0.3:5)';
y = x';
V = cos(x) .* sin(y);
n = length(x);
surf(1:n,1:n,V)

%
% Interpolate the data using the default grid.

F = griddedInterpolant(V)

%
% Query the interpolant and plot the results.

[xq,yq] = ndgrid(1:0.2:n);
Vq = F(xq,yq);
surf(xq',yq',Vq)

% Copyright 2012 The MathWorks, Inc.