This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.


Class: timeseries

Interquartile range of timeseries data


ts_iqr = iqr(ts)
iqr(ts, Name, Value)


ts_iqr = iqr(ts) returns the interquartile range of ts.Data.

iqr(ts, Name, Value) reruns the interquatrile range of ts.Data with the specified Name, Value pairs.

Input Arguments


The timeseries object for which you want the interquartile range of timeseries data.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.


A string specifying one of two possible values, remove or interpolate, indicating how to treat missing data during the calculation.

Default: remove


A vector of integers, indicating which quality codes represent missing samples (for vector data) or missing observations (for data arrays with two or more dimensions).

Output Arguments


The interquartile range of ts.Data, as follows:

  • When ts.Data is a vector, ts_iqr is the difference between the 75th and the 25th percentiles of the ts.Data values.

  • When ts.Data is a matrix, and IsTimeFirst is true, and the first dimension of ts is aligned with time, then ts_iqr is a row vector containing the interquartile range of each column of ts.Data.

When ts.Data is an N-dimensional array, iqr always operates along the first nonsingleton dimension of ts.Data.


Create a time series with a missing value, represented by NaN, and then calculate the interquartile range of ts.Data after removing the missing value from the calculation:

ts = timeseries([3.0 NaN 5 6.1 8], 1:5);

MATLAB® returns:


See Also

| | | | | | |

Introduced before R2006a

Was this topic helpful?