### Highlights from Scattered Data Interpolation and Approximation using Radial Base Functions

4.18182
4.2 | 12 ratings Rate this file 76 Downloads (last 30 days) File Size: 117 KB File ID: #10056 Version: 1.0

# Scattered Data Interpolation and Approximation using Radial Base Functions

### Alex Chirokov (view profile)

18 Feb 2006 (Updated )

Set of functions that can be used for interpolation and and approximation of scattered data of any d

File Information
Description

Radial base functions (RBF) can be used for interpolation and and approximation of scattered data i.e. data is not required to be on any regular grid. The same function can handle data interpolation in any dimension. See file rbftest.m for more examples.

1. Create RBF interpolation using
rbf=rbfcreate(x, f); ?x? ? coordinates of the nodes and ?f? - values of the function at the nodes

2. Calculate interpolated values ?fi? at nodes ?xi? using
fi = rbfinterp(xi, rbf); rbf ? is structure returned by rbf=rbfcreate(x, f)

%1D example
x = 0:1.25:10; f = sin(x);
xi = 0:.1:10;

%Matlab interpolation
fi = interp1(x,f,xi);

% RBF interpolation
rbf=rbfcreate(x, f);
fi = rbfinterp(xi, rbf);

%2D example
x = rand(50,1)*4-2; y = rand(50,1)*4-2; z = x.*exp(-x.^2-y.^2);

ti = -2:.05:2;
[XI,YI] = meshgrid(ti,ti);

%Matlab interpolation
ZI = griddata(x,y,z,XI,YI,'cubic');

%RBF interpolation
rbf=rbfcreate([x'; y'], z');
ZI = rbfinterp([XI(:)'; YI(:)'], op);
ZI = reshape(ZI, size(XI));

Optional parameters:

available RBF functions are: multiquadric, gaussian, linear, cubic, thinplate
2. Smoothing level: (must be a positive scalar)
rbfcreate(x, f ,'RBFSmooth', 0.1);
3. Multiquadric and gaussian functions have definable constants
rbfcreate(x, f ,?RBFConstant', 0.1);

RBF interpolation usually produces much better results that standard Matlab functions but computation complexity of RBF interpolation is n^3 thus it is not recommended to use it for more then 2000 nodes.

Acknowledgements

This file inspired Sound Power Directivity Analysis.

MATLAB release MATLAB 6.5 (R13)
Other requirements none
05 Jan 2015 walid silabdi

### walid silabdi (view profile)

please give me the programme of identification's systems no-linear with RBF network

04 Nov 2014 Michael Dicker

### Michael Dicker (view profile)

21 Nov 2011 Alejandro Arrizabalaga

### Alejandro Arrizabalaga (view profile)

Nice function. Only, for large data sets it easily runs into memory problems. This could be improved by using the fact that only half of the matrix A in rbfAssemble is actually needed, since it is symmetric.

19 Jun 2009 Seth

### Seth (view profile)

While this is not a perfectly implemented code for the file exchange (see J. D'Errico's comments) - it is exactly what I was looking for and has proven extremely helpful for my engineering problem. The big ticket item for me was the ability to extrapolate scattered data (as well as interpolate). Thank you for providing this tool.

02 Mar 2009 Ying zhang

### Ying zhang (view profile)

good stuff, thanks

10 Sep 2007 Li Bin

very quickly, thanks!

13 Aug 2007 R.A. Smithies

Windows-only documentation, a complete waste of time

16 Feb 2007 John D'Errico

It seems the time is due to review this code again, at least Scott Andrews seems to think it is. Note that my first review was made before any improvements were made. It was an entirely accurate review at that time.

The Powerpoint doc is indeed quite helpful. But remember that when you choose to use this code in the future, it might be nice to have Matlab help available for these codes. I'll paste in the complete help provided for the rbfinterp function here:

[]

Yes. That is right. There is no help. No indication of what the arguments mean. So next month when you want to use these tools, you should drop out of matlab and fire up this file into powerpoint just to remember what order the arguments follow and what they mean? Sorry, but this is ridiculous.

Back to the Powerpoint doc. The author chooses to make an apples to oranges comparison to show how good these tools are. Surely the author understands that use of Matlab's Pchip interpolant is a poor choice for interpolating an ocsillatory function? Had the author actually compared a true spline fit to the RBF model, the difference would have been far smaller. Conversely, It is trivial to show an example of a monotone function where pchip (the interp1 'cubic' interpolant) will shine, yet RBF interpolation will be miserable.

My earlier comments about the slowness of RBF interpolation are still valid. These techniques create dense matrices, so interpolation over thousands of points may be slow.

Overall, the powerpoint help improves these tools considerably. The lack of any help for a main function would have normally pulled my rating down farther, but the author deserves commendation for the effort expended on the ppt doc. The error checking is good, plus its a good implementation of the property/value pair interface in rbfcreate. Plus, these tools do provide an alternative to linear interpolation in multiple dimensions.

16 Nov 2006 Scott Andrews

This is amazingly simple and well documented code. With regards to the prior reviewers comments, I'm not sure what aspect he believes difficult to use. I read the ppt included and was up and running in 5 minutes. Also, the package does interpolate and approximate. If the smoothing is off, then it interpolates exactly as advertised. The only slight downside is that the algo is a bit slow, but there is no way to fit high-dimensional data in any Mathworks package other than linear interpolations. As such, it is a wonderful addition.

04 Aug 2006 Oleg Gubanov

A very good introduction to RBF method.
The code is concise and clear, no extra comments required to figure out how it works. The package is good to conduct a quick test of how RBF methods work in particular application. Good work!

21 Jul 2006 hussein AHMED
23 Feb 2006 John D'Errico

This has potential. It also has virtually no help. No hints about how to use it, except by trying to read the uncommented test examples and guess what the options do. You will need to edit the code just to learn what the options are. Its a major flaw in a package that some might find as useful. I will also note that this package is touted as doing interpolation, but the examples show that smoothing was done. Interpolation REPRODUCES the original data. It should not smooth the data, so the description is inaccurate.
Finally, I'll repeat the athor's statement that this code will be slow for large sets of data. It will easily exceed your system memory since it generates large dense matrices.
I would have given this code a lower rating, except I also recognize that this code, when cleaned up, might actually be useful. That is, if anybody but the author could figure out how to use it.