# spline¶

## Purpose¶

Computes a two-dimensional interpolatory spline.

## Format¶

{ u, v, w } = spline(x, y, z, sigma, g)
Parameters: x (Kx1 vector) – x-abscissae (x-axis values). y (Nx1 vector) – y-abscissae (y-axis values). z (KxN matrix) – ordinates (z-axis values). sigma (scalar) – tension factor. g (scalar) – grid size factor. u ((K*g)x1 vector) – x-abscissae, regularly spaced. v ((N*g)x1 vector) – y-abscissae, regularly spaced. w ((K*g)x(N*g) matrix) – interpolated ordinates.

## Example¶

// Example data
x = seqa(1, 1, 5);
y = seqa(1, 1, 6);

z = { 3 3 2 4 5 4,
3 3 2 3 4 5,
4 3 2 2 4 4,
4 4 3 3 5 6,
5 6 4 4 6 7 };

plotsurface(x', y, z');

// Set tension factor
Sigma = 1;

// Set grid factor
GridFactor = 3;

// Smooth data using spline
{ xx,yy,zz } = spline(x, y, z, Sigma, GridFactor);

// Plot new data
plotOpenWindow;
plotsurface(xx', yy, zz');


## Remarks¶

sigma contains the tension factor. This value indicates the curviness desired. If sigma is nearly zero (e.g., .001), the resulting surface is approximately the tensor product of cubic splines. If sigma is large (e.g., 50.0), the resulting surface is approximately bi-linear. If sigma equals zero, tensor products of cubic splines result. A standard value for sigma is approximately 1.

g is the grid size factor. It determines the fineness of the output grid. For $$g = 1$$, the output matrices are identical to the input matrices. For $$g = 2$$, the output grid is twice as fine as the input grid, i.e., u will have twice as many columns as x, v will have twice as many rows as y, and w will have twice as many rows and columns as z.

## Source¶

spline.src

Functions curve()