demoRBFInterpolants

PURPOSE ^

demoRBFInterpolants Simple script showing the different RBF interpolants available in the toolbox.

SYNOPSIS ^

function demoRBFInterpolants(dataId)

DESCRIPTION ^

demoRBFInterpolants Simple script showing the different RBF interpolants available in the toolbox.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function demoRBFInterpolants(dataId)
0002 %demoRBFInterpolants Simple script showing the different RBF interpolants available in the toolbox.
0003 
0004     %% Parse parameters
0005     if nargin < 1 || isempty(dataId)
0006         dataId = 'seamount';
0007     end
0008 
0009     %% Get the sample data and options
0010     [x, y, z, xi, yi, zt, demoOptions] = getSampleDataset(dataId);
0011     
0012     %% Show the original function evaluated on the grid, if available
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         % Print a text in the subplot location?
0024     end
0025     
0026     %% Prepare show the scattered input data
0027     plotResult(x, y, z, [], [], [], spNumRows, spNumCols, 2, 'Input Samples', xLabel, yLabel, zLabel, axisEqual);
0028     
0029     %% Apply the RBF interpolant with all the RBF definitions available
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

Generated on Thu 10-Dec-2020 17:34:27 by m2html © 2005