Accelerating the pace of engineering and science

# Documentation

## Constructing and Working with stform Splines

### Introduction to the stform

A multivariate function form quite different from the tensor-product construct is the scattered translates form, or stform for short. As the name suggests, it uses arbitrary or scattered translates ψ(· –cj) of one fixed function ψ, in addition to some polynomial terms. Explicitly, such a form describes a function

$f\left(x\right)=\sum _{j=1}^{n-k}\psi \left(x-{c}_{j}\right){a}_{j}+p\left(x\right)$

in terms of the basis function ψ, a sequence (cj) of sites called centers and a corresponding sequence (aj) of n coefficients, with the final k coefficients, an-k+1,...,an, involved in the polynomial part, p.

When the basis function is radially symmetric, meaning that ψ(x) depends only on the Euclidean length |x| of its argument, x, then ψ is called a radial basis function, and, correspondingly, f is then often called an RBF.

At present, the toolbox works with just one kind of stform, namely a bivariate thin-plate spline and its first partial derivatives. For the thin-plate spline, the basis function is ψ(x) = φ(|x|2), with φ(t) = tlogt, i.e., a radial basis function. Its polynomial part is a linear polynomial, i.e., p(x)=x(1)an – 2+x(2)an – 1+an. The first partial derivative with respect to its first argument uses, correspondingly, the basis function ψ(x)=φ(|x|2), with φ(t) = (D1t)·(logt+1) and D1t = D1t(x) = 2x(1), and p(x) = an.

### Construction and Properties of the stform

A function in stform can be put together from its center sequence centers and its coefficient sequence coefs by the command

```f = stmak(centers, coefs, type);
```

with the string type one of 'tp00', 'tp10', 'tp01', to indicate, respectively, a thin-plate spline, a first partial of a thin-plate spline with respect to the first argument, and a first partial of a thin-plate spline with respect to the second argument. There is one other choice, 'tp'; it denotes a thin-plate spline without any polynomial part and is likely to be used only during the construction of a thin-plate spline, as in tpaps.

A function f in stform depends linearly on its coefficients, meaning that

$f\left(x\right)=\sum _{j=1}^{n}{\psi }_{j}\left(x\right){a}_{j}$

with ψj either a translate of the basis function Ψ or else some polynomial. Suppose you wanted to determine these coefficients aj so that the function f matches prescribed values at prescribed sites xi. Then you would need the collocation matrix (ψj(xi)). You can obtain this matrix by the command stcol(centers,x,type). In fact, because the stform has aj as the jth column, coefs(:,j), of its coefficient array, it is worth noting that stcol can also supply the transpose of the collocation matrix. Thus, the command

```values = coefs*stcol(centers,x,type,'tr');
```

would provide the values at the entries of x of the st function specified by centers and type.

The stform is attractive because, in contrast to piecewise polynomial forms, its complexity is the same in any number of variables. It is quite simple, yet, because of the complete freedom in the choice of centers, very flexible and adaptable.

On the negative side, the most attractive choices for a radial basis function share with the thin-plate spline that the evaluation at any site involves all coefficients. For example, plotting a scalar-valued thin-plate spline via fnplt involves evaluation at a 51-by-51 grid of sites, a nontrivial task when there are 1000 coefficients or more. The situation is worse when you want to determine these 1000 coefficients so as to obtain the stform of a function that matches function values at 1000 data sites, as this calls for solving a full linear system of order 1000, a task requiring O(10^9) flops if done by a direct method. Just the construction of the collocation matrix for this linear system (by stcol) takes O(10^6) flops.

The command tpaps, which constructs thin-plate spline interpolants and approximants, uses iterative methods when there are more than 728 data points, but convergence of such iteration may be slow.

### Working with the stform

After you have constructed an approximating or interpolating thin-plate spline st with the aid of tpaps (or directly via stmak), you can use the following commands:

• fnbrk to obtain its parts or change its basic interval,

• fnval to evaluate it

• fnplt to plot it

• fnder to construct its two first partial derivatives, but no higher order derivatives as they become infinite at the centers.

This is just one indication that the stform is quite different in nature from the other forms in this toolbox, hence other fn... commands by and large don't work with stforms. For example, it makes no sense to use fnjmp, and fnmin or fnzeros only work for univariate functions. It also makes no sense to use fnint on a function in stform because such functions cannot be integrated in closed form.

• The command Ast = fncmb(st,A) can be used on st, provided A is something that can be applied to the values of the function described by st. For example, A might be 'sin', in which case Ast is the stform of the function whose coefficients are the sine of the coefficients of st. In effect, Ast describes the function obtained by composing A with st. But, because of the singularities in the higher-order derivatives of a thin-plate spline, there seems little point to make fndir or fntlr applicable to such a st.