www.gusucode.com > stats 源码程序 matlab案例代码 > stats/DescriptiveStatisticsExample.m
%% Compare Measures of Dispersion % This example shows how to compute and compare measures of dispersion for % sample data that contains one outlier. % Copyright 2015 The MathWorks, Inc. %% % Generate sample data that contains one outlier value. x = [ones(1,6),100] %% % Compute the interquartile range, mean absolute deviation, range, and % standard deviation of the sample data. stats = [iqr(x),mad(x),range(x),std(x)] %% % The interquartile range (|iqr|) is the difference between the 75th and % 25th percentile of the sample data, and is robust to outliers. The range % (|range|) is the difference between the maximum and minimum values in the % data, and is strongly influenced by the presence of an outlier. %% % Both the mean absolute deviation (|mad|) and the standard deviation % (|std|) are sensitive to outliers. However, the mean absolute deviation % is less sensitive than the standard deviation.