# Problem 2.11

basic meshfree interpolation with other RBFs

## Contents

## comparison between euclidean distance, Gaussians and inverse multiquadrics

f = @(x) 4*x.*(1-x); phi = @(ep,r) exp(-(ep*r).^2); ep = 10; % Gaussian beta = 1; imqr = @(ep,r) (1+(ep*r).^2).^(-beta); % inverse multiquadric M = 1000; X_eval = linspace(0,1,M)'; N = logspace(1,2.8,20); for k=1:20, X = linspace(0,1,N(k))'; y = f(X); D1 = distm(X,X); c1 = D1\y; D2 = phi(ep,distm(X,X)); c2 = D2\y; D3 = imqr(ep,distm(X,X)); c3 = D3\y; D_eval1 = distm(X_eval,X); D_eval2 = phi(ep,distm(X_eval,X)); D_eval3 = imqr(ep,distm(X_eval,X)); err_1(k) = norm(D_eval1*c1 - f(X_eval))/sqrt(M); err_2(k) = norm(D_eval2*c2 - f(X_eval))/sqrt(M); err_3(k) = norm(D_eval3*c3 - f(X_eval))/sqrt(M); end clf; loglog(N,err_1,'o-',N,err_2,'ro-',N,err_3,'mo-'); xlabel('N'); ylabel('errors'); legend('euclidean distance','Gaussians','inv. multiquadric (\beta = 1)')

Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.819048e-17. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.160602e-18. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.070905e-18. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.522113e-18. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.251374e-19. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.121269e-20. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.668393e-18. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.365660e-19. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.515476e-20. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.884628e-20. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 9.104271e-20. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.779828e-20. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.721455e-21. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 9.420485e-21. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.153599e-20. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.257635e-20. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.422394e-20. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 7.605220e-21. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 9.542422e-21. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.089258e-20. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 8.360282e-21.