Range of values


y = range(X,dim)


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 of X.

y = range(X,dim) operates along the dimension dim of X.

range treats NaNs 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.


The range of a large sample of standard normal random numbers is approximately six. This is the motivation for the process capability indices Cp and Cpk in statistical quality control applications.

rv = normrnd(0,1,1000,5);
near6 = range(rv)
near6 =
  6.1451  6.4986  6.2909  5.8894  7.0002

See Also

| |

Was this topic helpful?