MA 5324 Problem 1.4

basic meshfree interpolation with euclidean distance basis functions (2)

Contents

error in dependence of N

f = @(x) 4*x.*(1-x);
M = 1000;
Xt = linspace(0,1,M)';
N = logspace(1,2.9,20);
for k = 1:20,
    tic;
    X = linspace(0,1,N(k))';
    y = f(X);
    D = distm(X,X);
    c = D\y;
    yt = distm(Xt,X)*c;
    err_2(k) = norm(yt-f(Xt))/sqrt(M);
    err_inf(k) = norm(yt-f(Xt),inf);
    cnd(k) = condest(D);
    t(k) = toc;
end
subplot(221);
loglog(N,err_2,'x-'); xlabel('N'); ylabel('$L^2$-error');
subplot(222);
loglog(N,err_inf,'x-'); xlabel('N'); ylabel('$L^\infty$-error'); axis tight
subplot(223);
semilogx(N,cnd,'x-'); xlabel('N'); ylabel('cond(D)');
subplot(224);
semilogx(N,t,'x-'); xlabel('N'); ylabel('cpu time [s]');