13.07.2015 Views

MATH 590: Meshfree Methods - Chapter 6 - Applied Mathematics

MATH 590: Meshfree Methods - Chapter 6 - Applied Mathematics

MATH 590: Meshfree Methods - Chapter 6 - Applied Mathematics

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Example: Reproduction of Linear Functions using Gaussian RBFsProgram (RBFInterpolation2Dlinear.m)1 rbf = @(e,r) exp(-(e*r).^2); ep = 6;2 testfunction = @(x,y) (x+y)/2;3 N = 9; gridtype = ’u’;4 dsites = CreatePoints(N,2,gridtype);5 ctrs = dsites;6 neval = 40; M = neval^2;7 epoints = CreatePoints(M,2,’u’);8 rhs = testfunction(dsites(:,1),dsites(:,2));9 rhs = [rhs; zeros(3,1)];10 DM_data = DistanceMatrix(dsites,ctrs);11 IM = rbf(ep,DM_data);12 PM = [ones(N,1) dsites];13 IM = [IM PM; [PM’ zeros(3,3)]];14 DM_eval = DistanceMatrix(epoints,ctrs);15 EM = rbf(ep,DM_eval);16 PM = [ones(M,1) epoints]; EM = [EM PM];17 Pf = EM * (IM\rhs);18 exact = testfunction(epoints(:,1),epoints(:,2));19 maxerr = norm(Pf-exact,inf)20 rms_err = norm(Pf-exact)/nevalfasshauer@iit.edu <strong>MATH</strong> <strong>590</strong> – <strong>Chapter</strong> 6 19

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!