HyperMath

Median

Median

Previous topic Next topic No expanding text in this topic  

Median

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

Median of a sample.

Syntax

M = Median(Data)

Argument

Name

Description

 

Data

Scalar, vector or matrix of samples of (real) numbers.

Output

Name

Description

 

M

The median. If the input is a matrix, then the median of each column is returned in a vector.

Example

Find the median of the data set [1,2,3,4,5,7].

 

Syntax

 

M = Median([1,2,3,4,5,7])

 

Result

 

M = 3.5

Comments

If Data is a scalar, the result is that value.

If Data is a vector with an odd number of elements, the result is a scalar that is the element at the center of the ordered vector (element (N+1)/2, where N is the number of elements).

If Data is a vector with an even number of elements, the result is a scalar that is the average value of the two elements closest to the center of the ordered vector (elements N/2 and (N+1)/2, where N is the number of elements).

See Also:

GeoMean

Mean

Descriptive Statistics