Function File: [dyi] = tps_val_der(x, coefs, xi, vectorize=true )

Evaluates the first derivative of a thin plate spline at given points
xi

coefs should be the vector of fitted coefficients returned from tpaps(x, y, [p])

x should be n by d in size, where n is the number of points and d the number of dimensions; coefs should be (n + d + 1) by 1; xi should be k by d

The logical argument vectorize controls whether k by n by d intermediate arrays are formed to speed up computation (the default) or whether looping is used to economize on memory

The returned dyi will be k by d, containing the first partial derivatives of the thin plate spline at xi

Example usages:

x = ([1:10 10.5 11.3])'; y = sin(x); dy = cos(x); xi = (0:0.1:12)';
coefs = tpaps(x, y, 0.5);
[dyi] = tps_val_der(x,coefs,xi);
subplot(1, 1, 1)
plot(x, dy, 's', xi, dyi)
legend('original', 'tps')
x = rand(100, 2)*2 - 1; 
y = x(:, 1) .^ 2 + x(:, 2) .^ 2;
[x1 y1] = meshgrid((-1:0.2:1)', (-1:0.2:1)');
xi = [x1(:) y1(:)];
coefs = tpaps(x, y, 1);
dyio = [2*x1(:) 2*y1(:)];
[dyi] = tps_val_der(x,coefs,xi);
subplot(2, 2, 1)
contourf(x1, y1, reshape(dyio(:, 1), 11, 11)); colorbar
title('original x1 partial derivative')
subplot(2, 2, 2)
contourf(x1, y1, reshape(dyi(:, 1), 11, 11)); colorbar
title('tps x1 partial derivative')
subplot(2, 2, 3)
contourf(x1, y1, reshape(dyio(:, 2), 11, 11)); colorbar
title('original x2 partial derivative')
subplot(2, 2, 4)
contourf(x1, y1, reshape(dyi(:, 2), 11, 11)); colorbar
title('tps x2 partial derivative')

See the documentation to tpaps for more information

See also: tpaps, tpaps_val, tps_val_der.

Package: splines