tsvar = var(
specifies additional options when computing the variance using one or more name-value pair
arguments. For example,
var( defines -99 as
the missing sample quality code, and removes the missing samples before computing the
Variance of Sample Data
timeseries object and compute the variance of the sample data.
ts = timeseries((1:10)'); tsvar = var(ts)
tsvar = 9.1667
ts — Input
timeseries, specified as a scalar.
Specify optional pairs of arguments as
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.
Quality — Missing value indicator
scalar | vector | matrix | multidimensional array
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, missing data is removed before computing. To interpolate the data
instead of removing it, specify the name-value pair
MissingData — Missing data method
'remove' (default) |
Missing data method, specified as either
'remove' to remove
missing values or
'interpolate' to fill missing values by
interpolating the data. Specify the
'Quality' name-value pair to
indicate which data samples are considered missing.
MATLAB® determines weighting by:
Attaching a weighting to each time value, depending on its order, as follows:
First time point — The duration of the first time interval
(t(2) - t(1)).
Time point that is neither the first nor last time point — The duration between the midpoint of the previous time interval to the midpoint of the subsequent time interval
((t(k + 1) - t(k))/2 + (t(k) - t(k - 1))/2).
Last time point — The duration of the last time interval
(t(end) - t(end - 1)).
Normalizing the weighting for each time by dividing each weighting by the mean of all weightings.
timeseriesobject is uniformly sampled, then the normalized weighting for each time is 1.0. Therefore, time weighting has no effect.
Multiplying the data for each time by its normalized weighting.