GenerateSpatialData - Maple Help

Interpolation[Kriging]

 GenerateSpatialData
 generate a spatially correlated data set

 Calling Sequence GenerateSpatialData(variogram) GenerateSpatialData(variogram,n,options)

Parameters

 variogram - a supported variogram model n - (optional) the (approximate) number of points generated. The default value is 30. options - (optional) keyword option of the form grid=truefalse or dimension=d. If grid is set to true, the generated data points will be equally spaced along each dimension (default: false). The dimension option sets the dimension of the points to be generated (default: 2).

Description

 • The GenerateSpatialData command takes a variogram and generates a set of points and associated data reflective of that variogram model. These points and data can then be used to experiment with, or demonstrate, Kriging interpolation.
 • If the grid=true option is given, then the points are located in a square $d$-dimensional grid, at coordinates equally spaced between 0 and 1. As a consequence, there will be ${k}^{d}$ points in total, for some $k$. Maple chooses $k$ as $⌊{n}^{\frac{1}{d}}⌋$; consequently, the number of points generated may be smaller than $n$. For example, if $d$ has its default value of 2, then the number of points will be reduced to the largest perfect square that is not greater than n.
 • If the grid=true option is not given, then the points are uniformly randomly selected from the $d$-dimensional unit cube. In this case, exactly $n$ points are generated.
 • The data set is returned as an expression sequence of a list of lists representing the points, and a Vector of values at those points.

Examples

We generate some points in two dimensions and associated data.

 > $\mathrm{points1},\mathrm{data1}≔\mathrm{Interpolation}:-\mathrm{Kriging}:-\mathrm{GenerateSpatialData}\left(\mathrm{Spherical}\left(1,10,1\right)\right)$
 ${\mathrm{points1}}{,}{\mathrm{data1}}{≔}\begin{array}{c}\left[\begin{array}{cc}{0.814723686393179}& {0.706046088019609}\\ {0.905791937075619}& {0.0318328463774207}\\ {0.126986816293506}& {0.276922984960890}\\ {0.913375856139019}& {0.0461713906311539}\\ {0.632359246225410}& {0.0971317812358475}\\ {0.0975404049994095}& {0.823457828327293}\\ {0.278498218867048}& {0.694828622975817}\\ {0.546881519204984}& {0.317099480060861}\\ {0.957506835434298}& {0.950222048838355}\\ {0.964888535199277}& {0.0344460805029088}\\ {⋮}& {⋮}\end{array}\right]\\ \hfill {\text{30 × 2 Matrix}}\end{array}{,}\begin{array}{c}\left[\begin{array}{c}{-1.31317888309841}\\ {3.78399452938781}\\ {-4.07906747556730}\\ {2.81033657021080}\\ {3.07159908082332}\\ {0.128958765233144}\\ {-3.21737272238246}\\ {0.707245165710619}\\ {0.0877877303791926}\\ {0.937296621856498}\\ {⋮}\end{array}\right]\\ \hfill {\text{30 element Vector[column]}}\end{array}$ (1)

These can be used to demonstrate Kriging interpolation.

 > $\mathrm{k1}≔\mathrm{Interpolation}:-\mathrm{Kriging}\left(\mathrm{points1},\mathrm{data1}\right)$
 ${\mathrm{k1}}{≔}\left(\begin{array}{c}{Kriging intⅇrpolation obȷⅇct with 30 samplⅇ points}\\ {Variogram: Sphⅇrical\left(1.25259453854482,13.6487615617247,.5525536774\right)}\end{array}\right)$ (2)
 > $\mathrm{SetVariogram}\left(\mathrm{k1},\mathrm{Spherical}\left(1,10,1\right)\right)$
 $\left(\begin{array}{c}{Kriging intⅇrpolation obȷⅇct with 30 samplⅇ points}\\ {Variogram: Sphⅇrical\left(1,10,1\right)}\end{array}\right)$ (3)
 > $\mathrm{ComputeGrid}\left(\mathrm{k1},\left[0..1,0..1\right],0.1,\mathrm{output}=\mathrm{plot}\right)$

We now generate some points in a three-dimensional grid and associated data.

 > $\mathrm{points2},\mathrm{data2}≔\mathrm{Interpolation}:-\mathrm{Kriging}:-\mathrm{GenerateSpatialData}\left(\mathrm{RationalQuadratic}\left(0.1,10,4\right),216,\mathrm{dimension}=3,\mathrm{grid}=\mathrm{true}\right)$
 ${\mathrm{points2}}{,}{\mathrm{data2}}{≔}\begin{array}{c}\left[\begin{array}{ccc}{0.}& {0.}& {0.}\\ {0.200000000000000}& {0.}& {0.}\\ {0.400000000000000}& {0.}& {0.}\\ {0.600000000000000}& {0.}& {0.}\\ {0.800000000000000}& {0.}& {0.}\\ {1.}& {0.}& {0.}\\ {1.}& {0.200000000000000}& {0.}\\ {0.800000000000000}& {0.200000000000000}& {0.}\\ {0.600000000000000}& {0.200000000000000}& {0.}\\ {0.400000000000000}& {0.200000000000000}& {0.}\\ {⋮}& {⋮}& {⋮}\end{array}\right]\\ \hfill {\text{216 × 3 Matrix}}\end{array}{,}\begin{array}{c}\left[\begin{array}{c}{-7.24064444344000}\\ {-7.04470706561314}\\ {-6.78359898038514}\\ {-6.52781963683906}\\ {-4.98147399010851}\\ {-3.11344813876699}\\ {-3.32786898604254}\\ {-5.73148375450573}\\ {-6.06925765878197}\\ {-6.70824019207924}\\ {⋮}\end{array}\right]\\ \hfill {\text{216 element Vector[column]}}\end{array}$ (4)
 > $\mathrm{k2}≔\mathrm{Interpolation}:-\mathrm{Kriging}\left(\mathrm{points2},\mathrm{data2}\right)$
 ${\mathrm{k2}}{≔}\left(\begin{array}{c}{Kriging intⅇrpolation obȷⅇct with 216 samplⅇ points}\\ {Variogram: Sphⅇrical\left(1.49801816144044,21.6426663001048,.8\right)}\end{array}\right)$ (5)
 > $\mathrm{SetVariogram}\left(\mathrm{k2},\mathrm{RationalQuadratic}\left(0.1,10,4\right)\right)$
 $\left(\begin{array}{c}{Kriging intⅇrpolation obȷⅇct with 216 samplⅇ points}\\ {Variogram: RationalQuaⅆratic\left(.1,10,4\right)}\end{array}\right)$ (6)
 > $\mathrm{plots}:-\mathrm{implicitplot3d}\left(\mathrm{k2}\left(x,y,z\right)=\mathrm{Statistics}:-\mathrm{Median}\left(\mathrm{data2}\right),x=0..1,y=0..1,z=0..1,\mathrm{grid}=\left[8,8,8\right]\right)$
 > 

Compatibility

 • The Interpolation[Kriging][GenerateSpatialData] command was introduced in Maple 2018.