Home > freetb4matlab > statistics > mad.m

## PURPOSE

% Compute the mean/median absolute deviation of @var{x}.

## SYNOPSIS

function a = mad (X, flag = 0, dim = [])

## DESCRIPTION

% -*- texinfo -*-
% @deftypefn {Function File} mad (@var{x})
% @deftypefnx{Function File} mad (@var{x}, @var{flag})
% @deftypefnx{Function File} mad (@var{x}, @var{flag}, @var{dim})
% Compute the mean/median absolute deviation of @var{x}.
%
% The mean absolute deviation is computed as
%
% @example
% mean (abs (@var{x} - mean (@var{x})))
% @end example
%
% and the median absolute deviation is computed as
%
% @example
% median (abs (@var{x} - median (@var{x})))
% @end example
%
% Elements of @var{x} containing NaN or NA values are ignored during computations.
%
% If @var{flag} is 0, the absolute mean deviation is computed, and if @var{flag}
% is 1, the absolute median deviation is computed. By default @var{flag} is 0.
%
% This is done along the dimension @var{dim} of @var{x}. If this variable is not
% given, the mean/median absolute deviation s computed along the smallest dimension of
% @var{x}.
%
% @seealso{std}
% @end deftypefn

## CROSS-REFERENCE INFORMATION

This function calls:
• nanmean % Compute the mean value while ignoring NaN values.
• nanmedian % Compute the median of data while ignoring NaN values.
This function is called by:

Generated on Sat 16-May-2009 00:04:49 by m2html © 2003