0001 function demoRBFInterpolants(dataId)
0002
0003
0004
0005 if nargin < 1 || isempty(dataId)
0006 dataId = 'seamount';
0007 end
0008
0009
0010 [x, y, z, xi, yi, zt, demoOptions] = getSampleDataset(dataId);
0011
0012
0013 figure;
0014 xLabel = demoOptions.Plot.XLabel;
0015 yLabel = demoOptions.Plot.YLabel;
0016 zLabel = demoOptions.Plot.ZLabel;
0017 axisEqual = demoOptions.Plot.AxisEqual;
0018 spNumRows = 3;
0019 spNumCols = 4;
0020 if ~isempty(zt)
0021 plotResult([], [], [], xi, yi, zt, spNumRows, spNumCols, 1, 'Original Function', xLabel, yLabel, zLabel, axisEqual);
0022 else
0023
0024 end
0025
0026
0027 plotResult(x, y, z, [], [], [], spNumRows, spNumCols, 2, 'Input Samples', xLabel, yLabel, zLabel, axisEqual);
0028
0029
0030 types = {'linear', 'cubic', 'quintic', 'multiquadric', 'thinplate', 'green', 'tensionspline', 'regularizedspline', 'gaussian', 'wendland'};
0031 for i = 1:numel(types)
0032 fprintf('- Interpolating using the Radial Basis Function Interpolant (%s kernel)...', types{i});
0033 tic;
0034 if isfield(demoOptions.RBF.(types{i}), 'RBFEpsilonIsNormalized')
0035 RBFEpsilonIsNormalized = demoOptions.RBF.(types{i}).RBFEpsilonIsNormalized;
0036 else
0037 RBFEpsilonIsNormalized = false;
0038 end
0039 rbfInterp = RBFInterpolant(x, y, z, 'DistanceType', demoOptions.DistanceType, ...
0040 'PolynomialDegree', demoOptions.RBF.(types{i}).PolynomialDegree, ...
0041 'RBF', types{i}, ...
0042 'RBFEpsilon', demoOptions.RBF.(types{i}).RBFEpsilon, ...
0043 'RBFEpsilonIsNormalized', RBFEpsilonIsNormalized, ...
0044 'Regularization', demoOptions.RBF.(types{i}).Regularization);
0045 ziRBF = rbfInterp.interpolate(xi, yi);
0046 t = toc;
0047 fprintf(' done (%f seconds)\n', t);
0048 plotResult(x, y, z, xi, yi, ziRBF, spNumRows, spNumCols, i+1, [types{i} ' RBF Interpolant'], xLabel, yLabel, zLabel, axisEqual);
0049 end
0050 end