Function File: [yi p] = tpaps(x, y, p, xi)
Function File: [coefs p] = tpaps(x, y, p, [])

Thin plate smoothing of scattered values in multi-D
approximately interpolate [x,y] at xi

The chosen thin plate spline minimizes the sum of squared deviations from the given points plus a penalty term proportional to the curvature of the spline function

x should be n by d in size, where n is the number of points and d the number of dimensions; y and w should be n by 1; xi should be k by d; the points in x should be distinct

p=0

maximum smoothing: flat surface

p=1

no smoothing: interpolation

p<0 or not given

an intermediate amount of smoothing is chosen (such that the smoothing term and the interpolation term are of the same magnitude)

If xi is not specified, returns a vector coefs of the n + d + 1 fitted thin plate spline coefficients. Given coefs, the value of the thin-plate spline at any xi can be determined with tps_val

Note: Computes the pseudoinverse of an n by n matrix, so not recommended for very large n

Example usages:

x = ([1:10 10.5 11.3])'; y = sin(x); xi = (0:0.1:12)';
yi = tpaps(x, y, 0.5, xi); 
plot(x, y, xi, yi)
x = rand(100, 2)*2 - 1; 
y = x(:, 1) .^ 2 + x(:, 2) .^ 2;
scatter(x(:, 1), x(:, 2), 10, y, "filled")
[x1 y1] = meshgrid((-1:0.2:1)', (-1:0.2:1)');
xi = [x1(:) y1(:)];
yi = tpaps(x, y, 1, xi);
contourf(x1, y1, reshape(yi, 11, 11))

Reference: David Eberly (2011), Thin-Plate Splines, www.geometrictools.com/Documentation/ThinPlateSplines.pdf Bouhamidi, A. (2005) Weighted thin plate splines, Analysis and Applications, 3: 297-324

See also: csaps, tps_val, tps_val_der.

Package: splines