range
Range of values
Syntax
range(X)
y = range(X,dim)
Description
range(X)
returns the difference between the maximum and the minimum of a sample. For vectors,range(x)
is the range of the elements. For matrices,range(X)
is a row vector containing the range of each column of X. For N-dimensional arrays,range
operates along the first nonsingleton dimension ofX
.
y = range(X,dim)
operates along the dimensiondim
ofX
.
range
treatsNaN
s as missing values and ignores them.
The range is an easily-calculated estimate of the spread of a sample. Outliers have an undue influence on this statistic, which makes it an unreliable estimator.
Examples
The range of a large sample of standard normal random numbers is approximately six. This is the motivation for the process capability indicesCpandCpkin statistical quality control applications.
rv = normrnd(0,1,1000,5); near6 = range(rv) near6 = 6.1451 6.4986 6.2909 5.8894 7.0002