# Kriging algorithm

Problem:

How does Tecplot calculate Kriging interpolation?

Solution:

Kriging and the Semivariogram. A semivariogram is a function that determines the relationship between distance and the variance of the data. Tecplot models the semivariogram with a spherical model using the range and zero value specified in the Kriging dialog as well as the variance of the variable(s) selected to krig.  Here are the details:

For each variable selected Tecplot calculates the variance of the variable across all source zones.  This is called s2.  Then Tecplot calculates the box that will hold all the source zones.  That is a minimum and maximum x y and possibly z.  Using this box the length of the diagonal across the box is determined. Call this L.

In 2D:  L = sqrt( (xmax-xmin)2 + (ymax-ymin)2) )

In 3D:  L = sqrt( (xmax-xmin)2 + (ymax-ymin)2) + (zmax-zmin)2) ) (sqrt is the square root.)

The actual range (a) used in Tecplots kriging is a = L * range_fraction_entered_in_kriging_dialog.   The semivariogram model used by Tecplot is then: g(h) = 0.5 * s2 * h/a * ( 3 – (h/a)2 ) for h < a s2 for h >= a This assumes a zero-value of zero. If the zero-value is other than zero the zero-value semivariance (Z) is Z = s2 * zero_value_fraction_entered_in_kriging_dialog and the equation becomes g(h) = Z + 0.5 * ( s2 – Z ) * h/a * ( 3 – (h/a)2 ) for h < a s2 for h >= a

Each time you krig in Tecplot the kriging range (a) and the variance for each variable (s2) is printed to the debug output. (You can access this output by specifying -debug filename on the Tecplot command line.)