FUNCTION REFERENCE
mad
Mean or median absolute deviation.
Mean or median absolute deviation.
Syntax
y = mad(X)Syntax
y = mad(X, flag)Syntax
y = mad(X, flag, dim)flag 0 or [] (default) gives the mean absolute deviation mean(abs(X - mean(X))); flag 1 gives the median absolute deviation median(abs(X - median(X))). No scale factor is applied. NaN values are ignored. mad([]) is NaN. X is double, single or logical: single input gives single results (computed in double, then rounded), and integer input is an error, as the published page lists single and double only.
Example
mad([1 2 3 4 100]) % 31.2Example
mad([1 2 3 4 100], 1) % 1Differences from MATLAB: No 'all' or vector dimensions. Real 2-D data only.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.