www.gusucode.com > stats 源码程序 matlab案例代码 > stats/ComputeTheInterquartileRangeExample.m

    %% Compute the Interquartile Range

% Copyright 2015 The MathWorks, Inc.


%%
% Generate a 4-by-4 matrix of random data from a normal distribution with
% parameter values $\mu$ equal to 10 and $\sigma$ equal to 1.
rng default  % For reproducibility
x = normrnd(10,1,4)

%%
% Compute the interquartile range for each column of data.
r = iqr(x)

%%
% Compute the interquartile range for each row of data.
r2 = iqr(x,2)