Main Content


Interquartile range of timeseries data



tsiqr = iqr(ts) returns the interquartile range of the data samples in a timeseries object.

tsiqr = iqr(ts,Name,Value) specifies additional options when computing the interquartile range using one or more name-value pair arguments. For example, tsiqr = iqr(ts,'Quality',-99,'MissingData','remove') defines -99 as the missing sample quality code, and removes the missing samples before computing the interquartile range.


collapse all

Create a timeseries object and compute the interquartile range of the sample data.

ts = timeseries((1:10)');
tsiqr = iqr(ts)
tsiqr = 5

Input Arguments

collapse all

Input timeseries, specified as a scalar.

Data Types: timeseries

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: tsiqr = iqr(ts,'Quality',-99,'MissingData','remove')

Missing value indicator, specified a scalar, vector, matrix, or multidimensional array of integers ranging from -128 to 127. Each element is a quality code to treat as missing data.

By default, iqr removes any missing data before computing the interquartile range. To interpolate the data instead of removing it, specify the name-value pair 'MissingData','interpolation'.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Missing data method, specified as either 'remove' to remove missing values before computing the interquartile range or 'interpolate' to fill missing values by interpolating the data. Specify the 'Quality' name-value pair to indicate which data samples are considered missing.

Version History

Introduced before R2006a

See Also

| | |