reduce3d

reduce3d removes data points from an x/y/z dataset.

idx = reduce3d(rvX, rvY, rvZ, nClasses, nType)

Return Value

idx

Parameters

rvX

rvX is a vector with x-coordinates.

rvY

rvY is a vector with y-coordinates.

rvZ

rvZ is a vector with z-coordinates.

nClasses

nClasses is a number in the range 2 to 1000 (Default value is 100). The parameter specifies the number of bins in the x- and y-directions. For a negative value the bins are moved by a half of the bin width.

nType

nType is on of the following values (Default value is 5):

Wert Bedeutung
0 or “first” First point of each bin will be used.
1 or “last” Last point of each bin will be used.
2 or “zmin” The point with smallest z-value for each bin.
3 or “zmax” The point with greatest z-value for each bin.
4 or “mean” The point that is closest to the mean value will be used.
5 or “median” The point that is closest to the median point will be used.

Comment

The data is categorized into bins in the x- and y-direction. For each bin only one data point is used depending of the nType parameter. For a grid of 100 by 100 bins, the number of data points is reduced to 10,000 data points. Because not all bins contain points the number is usually smaller. If all points lie on a straight line, only 100 points are returned.

NaNs (0/0), Infs (1/0), Missing Values (1e10) and values smaller than -1e10 or greater than 1e10 are removed as well.

Example

def XYZFilterCallback(x, y, z)
{
    return reduce3d(x,y,z, 40, "median");
}
def test_xyz()
{
    x = rand(100000, 1)*15-7.5;
    y = rand(100000, 1)*15-7.5;
    r=sqrt(x.*x + y.*y);
    z=sin(r)./r;
    plotxyz(x,y,z);
}

History

Version Description
5.10.2 New.

id-1623504