# Problem 4.5

meshfree interpolation with compactly supported RBFs

## Contents

## Gaussian and Wendland RBFs

f = @(x) 4*x.*(1-x); phi = @(r) exp(-r.^2); ep = 1; % Gaussian wld30 = @(r) max(1-r,0).^2; % Wendlands \phi_3,0 wld31 = @(r) max(1-r,0).^4.*(4*r+1); % Wendlands \phi_3,1 wld32 = @(r) max(1-r,0).^6.*(35*r.^2+18*r+3)/3; % Wendlands \phi_3,2 wld33 = @(r) max(1-r,0).^8.*(32*r.^3+25*r.^2+8*r+1); % Wendlands \phi_3,3 x = linspace(0,2,100); plot(x,phi(3*x),'-',x,wld30(x),'r-',x,wld31(x),'m-',x,wld32(x),'k-',x,wld33(x),'g-'); xlabel('x'); ylabel('\phi'); legend('Gaussians','Wendland 3,0','Wendland 3,1','Wendland 3,2','Wendland 3,3')

## comparison

M = 2000; X_eval = linspace(1/M,1-1/M,M)'; N = logspace(1,3,30); for k=1:30, X = linspace(0,1,N(k))'; y = f(X); D = distm(X,X); D1 = phi(3*ep*D); c1 = D1\y; D2 = wld30(ep*D); c2 = D2\y; D3 = wld31(ep*D); c3 = D3\y; D4 = wld32(ep*D); c4 = D4\y; D5 = wld33(ep*D); c5 = D5\y; D_e = distm(X_eval,X); D_e1 = phi(3*ep*D_e); D_e2 = wld30(ep*D_e); D_e3 = wld31(ep*D_e); D_e4 = wld32(ep*D_e); D_e5 = wld33(ep*D_e); y_eval = f(X_eval); err_1(k) = norm(D_e1*c1 - y_eval)/sqrt(M); cond1(k) = condest(D1); err_2(k) = norm(D_e2*c2 - y_eval)/sqrt(M); cond2(k) = condest(D2); err_3(k) = norm(D_e3*c3 - y_eval)/sqrt(M); cond3(k) = condest(D3); err_4(k) = norm(D_e4*c4 - y_eval)/sqrt(M); cond4(k) = condest(D4); err_5(k) = norm(D_e5*c5 - y_eval)/sqrt(M); cond5(k) = condest(D5); end clf; loglog(N,err_1,'o-',N,err_2,'ro-',N,err_3,'mo-',N,err_4,'ko-',N,err_5,'go-'); xlabel('N'); ylabel('errors'); legend('Gaussians','Wendland 3,0','Wendland 3,1','Wendland 3,2','Wendland 3,3') figure loglog(N,cond1,'o-',N,cond2,'ro-',N,cond3,'mo-',N,cond4,'ko-',N,cond5,'go-'); xlabel('N'); ylabel('condition'); legend('Gaussians','Wendland 3,0','Wendland 3,1','Wendland 3,2','Wendland 3,3')

Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.639196e-17. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.701602e-18. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.887355e-18. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 9.970463e-19. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 8.791070e-19. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.434898e-18. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 7.670766e-20. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.431458e-19. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.481175e-19. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.766846e-19. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.845894e-20. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 9.031678e-20. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.523491e-20. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 9.472132e-21. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.861944e-20. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.092137e-21. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.516461e-21. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.775548e-20. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.330198e-17. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.778575e-21. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.111697e-19. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 8.530781e-21. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.914603e-20. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.051972e-21. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.057953e-20. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.711948e-21. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.028919e-20. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.671844e-21. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.935918e-21. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.258611e-21. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.514171e-23. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 7.966385e-22. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.589675e-20. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.644357e-21. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 8.891769e-17. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.019618e-21.