Computes a two-dimensional interpolatory spline.


{ u, v, w } = spline(x, y, z, sigma, g)
  • 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.


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.