demoQuadTreePURBFInterpolants

PURPOSE ^

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

SYNOPSIS ^

function demoQuadTreePURBFInterpolants(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 demoQuadTreePURBFInterpolants(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     %% Apply the RBF interpolant with all the RBF definitions available
0027     types = {'linear', 'cubic', 'quintic', 'multiquadric', 'thinplate', 'green', 'tensionspline', 'regularizedspline', 'gaussian', 'wendland'};
0028 %     types = {'linear'};
0029     spInd = 2;
0030     for i = 1:numel(types)
0031         fprintf('- Interpolating using the Radial Basis Function Interpolant (%s kernel)...', types{i});
0032         tic;
0033         rbfInterp = QuadTreePURBFInterpolant(x, y, z, 'MinPointsInCell', demoOptions.PURBF.MinPointsInCell, ...
0034                                                       'MinCellSizePercent', demoOptions.PURBF.MinCellSizePercent, ...
0035                                                       'Overlap', demoOptions.PURBF.Overlap, ...
0036                                                       'Domain', demoOptions.PURBF.Domain, ...
0037                                                       'DistanceType', demoOptions.DistanceType, ...
0038                                                       'PolynomialDegree', demoOptions.RBF.(types{i}).PolynomialDegree, ...
0039                                                       'RBF', types{i}, ...
0040                                                       'RBFEpsilon', demoOptions.RBF.(types{i}).RBFEpsilon, ... 
0041                                                       'Regularization', demoOptions.RBF.(types{i}).Regularization);
0042 
0043         if i == 1
0044             % Show the QuadTree decomposition as the 2nd subplot
0045             subplot(spNumRows, spNumCols, spInd);
0046             title('Input Samples + Quad Tree decomposition');
0047             rbfInterp.plot(false);
0048             spInd = spInd+1;
0049         end
0050 
0051         ziRBF = rbfInterp.interpolate(xi, yi);
0052         t = toc;
0053         fprintf(' done (%f seconds)\n', t);
0054         plotResult(x, y, z, xi, yi, ziRBF, spNumRows, spNumCols, spInd, [types{i} ' RBF Interpolant'], xLabel, yLabel, zLabel, axisEqual);
0055         spInd = spInd+1;
0056     end
0057 end

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