Scattered translates collocation matrix
colmat = stcol(centers,x,type)
colmat = stcol(...,'tr')
colmat = stcol(centers,x,type)
is the matrix whose (i
,j
)th
entry is
$${\psi}_{j}\left(x(:,i)\right),\text{}i=1:\text{size}(x,2),j=1:n$$
with the bivariate functions ψ_{j} and
the number n
depending on the centers
and
the string type
, as detailed in the description
of stmak
.
centers
and x
must be
matrices with the same number of rows.
The default for type
is the string 'tp'
,
and for this default, n
equals size(centers,2)
,
and the functions ψ_{j} are
given by
$${\psi}_{j}(x)=\psi \left(x-\text{centers}(:,j)\right),\text{}j=1:n$$
with ψ the thin-plate spline basis function
$$\psi (x)={\left|x\right|}^{2}\mathrm{log}{\left|x\right|}^{2}$$
and with |x| denoting the Euclidean norm of the vector x.
Note
See |
The matrix colmat
is the coefficient matrix
in the linear system
$$\sum _{j}{a}_{j}{\psi}_{j}(x(:,i))={y}_{i},\text{}i=1:\text{size}(x,2)$$
that the coefficients a_{j} of
the function f = Σ_{j}a_{j}ψ_{j} must
satisfy in order that f interpolate the value y_{i} at
the site x(:,i)
, all i
.
colmat = stcol(...,'tr')
returns the transpose of the matrix returned by stcol(...)
.
Example 1. The following evaluates and plots the function
$$f(x)=\psi (x-{c}_{1})+\psi (x-{c}_{2})+\psi (x-{c}_{3})-3.5\psi (x)$$
on a regular mesh, with ψ the above thin-plate basis function, and with c_{1}, c_{2}, c_{3} three points on the unit circle; see the figure below.
a = [0,2/3*pi,4/3*pi]; centers = [cos(a), 0; sin(a), 0]; [xx,yy] = ndgrid(linspace(-2,2,45)); xy = [xx(:) yy(:)].'; coefs = [1 1 1 -3.5]; zz = reshape( coefs*stcol(centers,xy,'tr') , size(xx)); surf(xx,yy,zz), view([240,15]), axis off
Example 2. The following also evaluates, on the same mesh, and plots the length of the gradient of the function in Example 1.
zz = reshape( sqrt(... ([coefs,0]*stcol(centers,xy,'tp10','tr')).^2 + ... ([coefs,0]*stcol(centers,xy,'tr','tp01')).^2), size(xx)); figure, surf(xx,yy,zz), view([220,-15]), axis off