avg

From DavinciWiki
(Redirected from Avg)
Jump to: navigation, search


Description

The avg() function computes the statistical average (mean) along one or more axis. If no axis is specified, then the average is computed along all three.

Arguments and Return Values

Arguments: An array of any numeric type and organization, and an axis along which to compute the average. Return Value: avg() always returns a DOUBLE array.

Usage

Syntax: avg(object = VAL [, axis = OPTION] [, both = 1] [, ignore = VAL])

'object' - may be any numeric array of any data type and format

'axis' - Option to compute average along specified axis. Options include: x, y, z, xy, xz, yz, xyz.

'both' - Option to return both the average and the standard deviation in a structure

'ignore' - Optional value to ignore in average and standard deviation calculation

If an ignore value is specified, then any element that is equal to the ignore value is not included in the computation. If all the values in the computation are equal to the ignore value, then the output is set to the ignore value.

Note: The avg function uses a one-pass accumulator that can experience round off error with lots of numbers.

Examples

 dv> a
 3x3x1 array of float, bsq format [36 bytes]
 0.296204        0.512341        0.0492002
 0.914697        0.319797        0.274103
 0.875370        0.896324        0.00839178

 dv> avg(a)
 0.460714

 dv> avg(a,axis=y)
 3x1x1 array of double, bsq format [24 bytes]
 0.695424        0.576154        0.110565

 dv> avg(a,axis=x)
 1x3x1 array of double, bsq format [24 bytes]
 0.285915
 0.502866
 0.593362

DavinciWiki Mini-Nav Bar

Contents


Contact Developers

  • davinci-dev [AT] mars.asu.edu

All other topics

  • See navigation on the left

Related Functions

Recent Core Changes

Modified On: 12-05-2010

Personal tools