Problem 7.1

Shepard's method in 2D

Contents

for Gaussians

s = 2; f = @(x) 4^s*prod(x.*(1-x),2);
ep = 3; rbf = @(r) exp(-(r).^2);
N = 3; X1d = linspace(0,1,N); [XX,YY] = meshgrid(X1d); X = [XX(:) YY(:)];
fX = f(X);
M = 30; X1de = linspace(0,1,M); [XXe,YYe] = meshgrid(X1de); Xe = [XXe(:) YYe(:)];
E = rbf(ep*distm(Xe,X));
E = E./repmat(E*ones(N^2,1),1,N^2);
Pf = E*fX;
surf(XXe,YYe,reshape(Pf,M,M)); shading interp
norm(Pf-f(Xe))/M^2
ans =
    0.0079

for compactly supported RBFs

s = 2; f = @(x) 4^s*prod(x.*(1-x),2);
rbf = @(r) max(spones(r)-r,0).^4.*(4*r+spones(r));
k = 10; N = 2^k+1; N^2, ep = 2^k+1;
X1d = linspace(0,1,N); [XX,YY] = meshgrid(X1d,X1d); X = [XX(:) YY(:)];
fX = f(X);
M = 16;
X1de = linspace(0,1,M); [XXe,YYe] = meshgrid(X1de); Xe = [XXe(:) YYe(:)];
E = rbf(ep*sdistm(Xe,X,1/ep));
E = spdiags(1./(E*ones(N^2,1)),0,M^2,M^2)*E;
Pf = E*fX;
surf(XXe,YYe,reshape(Pf,M,M)); shading interp
norm(Pf-f(Xe))/M
ans =
     1050625
ans =
   3.7456e-04