This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Mean deviation of a data sample

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.


stats::meandev(x1, x2, …)
stats::meandev([x1, x2, …])
stats::meandev(s, <c>)


stats::meandev( x1, x2, …, xn) returns the mean deviation


where is the mean of the data xi.

If all data are floating-point numbers, a float is returned. For symbolic data, the mean is returned as a symbolic expression.

The column index c is optional if the data are given by a stats::sample object containing only one non-string column.

External statistical data stored in an ASCII file can be imported into a MuPAD® session via import::readdata. In particular, see Example 1 of the corresponding help page.


Example 1

We calculate the mean deviation of some data:

stats::meandev(2, 33/7, PI)

Alternatively, the data may be passed as a list:

data:=[2, 33/7, PI]: stats::meandev(data)

If all data are floating-point numbers, the result is a float:


delete data:

Example 2

We create a sample of type stats::sample:

s := stats::sample([[22, 4, 1], [9, 8/3, 1], [2.0, 3, x]])
 22    4  1
  9  8/3  1
2.0    3  x

The mean deviations of the columns are computed:

stats::meandev(s, 1), stats::meandev(s, 2), stats::meandev(s, 3)

delete s:

Example 3

With symbolic arguments, the mean deviation is returned as a symbolic expression:

stats::meandev(x1, x2, x3)


x1, x2, …

The statistical data: arithmetical expressions


A sample of domain type stats::sample


A column index of the sample s: a positive integer. This column provides the data x1, x2 etc.

See Also

MuPAD Functions

Was this topic helpful?