%% Use an Interpolating Thin-Plate Spline to Construct a Map
% The following code uses an interpolating thin-plate spline to vector-valued data values to construct a map, from the plane to the plane, that carries the unit square \left\lbrace x:\left|x\left(j\right)\right|\le 1,j=1:2\right\rbrace approximately onto the unit disk \left\lbrace x:{x\left(1\right)}^2 +{x\left(2\right)}^2 \le 1\right\rbrace.

n = 64; t = linspace(0,2*pi,n+1); t(end) = [];
values = [cos(t); sin(t)];
centers = values./repmat(max(abs(values)),2,1);
st = tpaps(centers, values, 1);
fnplt(st), axis equal

% Note the choice of 1 for the smoothing parameter here, to obtain interpolation.
% Copyright 2019 The MathWorks, Inc.