Main Content

Fitting Values at N-D Grid with Tensor-Product Splines

Vector-valued splines are also used in the approximation to gridded data, in any number of variables, using tensor-product splines. The same spline-construction commands are used, only the form of the input differs. For example, if x is an m-vector, y is an n-vector, and z is an array of size [m,n], then cs = csapi({x,y},z); describes a bicubic spline f satisfying f(x(i),y(j))=z(i,j) for i=1:m,j=1:n. Such a multivariate spline can be vector-valued. For example, the following gives a perfectly acceptable sphere.

x = 0:4;
y = -2:2;
s2 = 1/sqrt(2);
z(3,:,:) = [0 1 s2 0 -s2 -1 0].'*[1 1 1 1 1];
z(2,:,:) = [1 0 s2 1 s2 0 -1].'*[0 1 0 -1 0];
z(1,:,:) = [1 0 s2 1 s2 0 -1].'*[1 0 -1 0 1];
sph = csape({x,y},z,["clamped","periodic"]);
fnplt(sph)
axis equal
axis off
title("Sphere Made by 3-D-Valued " + ...
    "Bivariate Tensor Product Spline")

Figure contains an axes object. The hidden axes object with title Sphere Made by 3-D-Valued Bivariate Tensor Product Spline contains an object of type surface.

The sphere's projection onto the (x,z)-plane is plotted by the following.

fnplt(fncmb(sph,[1 0 0; 0 0 1]))
axis equal
axis off
title("Planar Projection of Spline Sphere")

Figure contains an axes object. The hidden axes object with title Planar Projection of Spline Sphere contains an object of type line.