# 2.2.1.6 xyz_renka

## Brief Information

Convert XYZ data to matrix using Renka-Cline gridding

## Command Line Usage

 1. xyz_renka iz:=Col(3); 

2. xyz_renka iz:=Col(3) rows:=10 cols:=10; 

3. xyz_renka iz:=Col(3) om:=[MBook]MSheet!Mat(1); 

## Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Input iz

Input

XYZRange

<active>

Specifies the input XYZ range.

Rows rows

Input

int

20

Rows in the output matrix.

Columns cols

Input

int

20

Columns in the output matrix.

Output Matrix om

Output

MatrixObject

<new>

The output matrix.

See the syntax here.

## Description

This function performs gridding based on the algorithm that Renka and Cline developed in 1984. It includes three main steps:

1. Triangulation:

Connect all the data points to do a Thiessen triangulation in the X-Y plane, which means that the triangles in the plane are as nearly equiangular as possible.

Estimate a gradient in the x- and y-directions for each node as the partial derivatives of a quadratic function.

3. Interpolation:

For an arbitrary point P, compute the interpolated value using the data values and gradient estimates at each of the three vertices of the triangle which contains P.

For the 200~1000 data points and uniformly distributed case, Renka-Cline method could be a best choice.

## Examples

• To run from the Command window
1. Import XYZ Random Gaussian.dat on the \Samples\Matrix Conversion and Gridding folder.
2. Type xyz_renka 3 in the command window. Or type xyz_renka -d to bring up the dialog.
• Code Sample
/*
This example shows how convert random worksheet data into matrix by Renka-Cline gridding method.
The sample data is exe_path\Samples\Matrix Conversion and Gridding\XYZ Random Gaussian.dat
1. Load data to a new created workbook.
2. Random xyz gridding by Renka-Cline method.
3. Plot a wireframe graph.
*/
// Get sample data
fn$= system.path.program$ + "Samples\Matrix Conversion and Gridding\XYZ Random Gaussian.dat";
newbook;
impASC fn\$;
// Set the third column as Z column
wks.col3.type = 6;

// Convert worksheet data into matrix by Renka-Cline gridding method
xyz_renka 3;

// Plot
worksheet -p 242 wirefrm;

## References

[1]. Robert J. Renka, Interpolation of Data on the Surface of a Sphere, 1984, ACM Transactions on Mathematical Software.

[2]. Robert J. Renka, A Triangle-based C1 Interpolation Method, Rocky Mountain J. Math. Vol. 14, 1984, pp. 223-237.

## Related X-Functions

xyz_regular, xyz_renka, xyz_shep, xyz_shep_nag, xyz_sparse, xyz_tps

Keywords:worksheet