%% Smooth Approximant to Noisy Data of a Bivariate Function
% This example produces a smooth approximant to noisy data from a smooth bivariate function. Note the use of ndgrid here; use of meshgrid would produce an error.

x = -2:.2:2; y=-1:.25:1; 
[xx,yy] = ndgrid(x,y); 
rng(39);
z = exp(-(xx.^2+yy.^2)) + (rand(size(xx))-.5)/30;
sp = spaps({x,y},z,8/(60^2));  
fnplt(sp)
axis off

% Copyright 2019 The MathWorks, Inc.