demoVariogramAndKriging

PURPOSE ^

demoVariogramAndKriging Script showing the Variogram fitting and Kriging interpolant.

SYNOPSIS ^

function demoVariogramAndKriging(dataId)

DESCRIPTION ^

demoVariogramAndKriging Script showing the Variogram fitting and Kriging interpolant.
 Note: same result as in demoInterpolants, just that in this script we
 show the fitted experimental variogram.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function demoVariogramAndKriging(dataId)
0002 %demoVariogramAndKriging Script showing the Variogram fitting and Kriging interpolant.
0003 % Note: same result as in demoInterpolants, just that in this script we
0004 % show the fitted experimental variogram.
0005 
0006     %% Parse parameters
0007     if nargin < 1 || isempty(dataId)
0008         dataId = 'seamount';
0009     end
0010 
0011     %% Get the sample data and options
0012     [x, y, z, xi, yi, zt, demoOptions] = getSampleDataset(dataId);
0013     
0014     %% Create the variogram
0015     vg = Variogram(x, y, z, 'model', demoOptions.Kriging.Variogram.Type, ...
0016                             'DistanceType', demoOptions.DistanceType, ...
0017                             'NumBins', demoOptions.Kriging.Variogram.NumSamples, ...
0018                             'OptimNugget', demoOptions.Kriging.Variogram.OptimNugget);
0019     vg.plot();
0020     title('Experimental Variogram');
0021     
0022     %% Use it in the Kriging
0023     krigInterp = KrigingInterpolant(x, y, z, vg, 'DistanceType', demoOptions.DistanceType, ...
0024                                                  'PolynomialDegree', demoOptions.Kriging.PolynomialDegree, ...
0025                                                  'Regularization', demoOptions.Kriging.Regularization);
0026     ziKrig = krigInterp.interpolate(xi, yi);
0027     
0028     %% Prepare the base plot and show the scattered input data
0029     xLabel = demoOptions.Plot.XLabel;
0030     yLabel = demoOptions.Plot.YLabel;
0031     zLabel = demoOptions.Plot.ZLabel;
0032     axisEqual = demoOptions.Plot.AxisEqual;
0033     figure;
0034     plotResult(x, y, z, [], [], [], 1, 2, 1, 'Input Samples', xLabel, yLabel, zLabel, axisEqual);
0035     
0036     %% Show the Kriging results
0037     plotResult(x, y, z, xi, yi, ziKrig, 1, 2, 2, 'Kriging Interpolant', xLabel, yLabel, zLabel, axisEqual);    
0038 end

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