1 |
|
2 |
|
3 | # Function median
|
4 |
|
5 | Compute the median of a matrix or a list with values. The values are
|
6 | sorted and the middle value is returned. In case of an even number of
|
7 | values, the average of the two middle values is returned.
|
8 | Supported types of values are: Number, BigNumber, Unit
|
9 |
|
10 | In case of a (multi dimensional) array or matrix, the median of all
|
11 | elements will be calculated.
|
12 |
|
13 |
|
14 | ## Syntax
|
15 |
|
16 | ```js
|
17 | math.median(a, b, c, ...)
|
18 | math.median(A)
|
19 | ```
|
20 |
|
21 | ### Parameters
|
22 |
|
23 | Parameter | Type | Description
|
24 | --------- | ---- | -----------
|
25 | `args` | ... * | A single matrix or or multiple scalar values
|
26 |
|
27 | ### Returns
|
28 |
|
29 | Type | Description
|
30 | ---- | -----------
|
31 | * | The median
|
32 |
|
33 |
|
34 | ## Examples
|
35 |
|
36 | ```js
|
37 | math.median(5, 2, 7) // returns 5
|
38 | math.median([3, -1, 5, 7]) // returns 4
|
39 | ```
|
40 |
|
41 |
|
42 | ## See also
|
43 |
|
44 | [mean](mean.md),
|
45 | [min](min.md),
|
46 | [max](max.md),
|
47 | [sum](sum.md),
|
48 | [prod](prod.md),
|
49 | [std](std.md),
|
50 | [variance](variance.md),
|
51 | [quantileSeq](quantileSeq.md)
|