tsmean = mean(ts)
tsmean = mean(ts,Name,Value)
tsmean = mean(
specifies additional options when computing the mean using one or more name-value
pair arguments. For example,
defines -99 as the missing sample quality code, and removes the missing samples
before computing the mean.
timeseries object and compute the mean of the data samples.
ts = timeseries((1:5)'); tsmean = mean(ts)
tsmean = 3
timeseries, specified as a scalar.
comma-separated pairs of
the argument name and
Value is the corresponding value.
Name must appear inside quotes. You can specify several name and value
pair arguments in any order as
tsmean = mean(
'Quality'— Missing value indicator
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
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
(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
+ 1) - t(k))/2 + (t(k) - t(k - 1))/2).
Last time point — The duration of the last
(t(end) - t(end - 1)).
Normalizing the weighting for each time by dividing each weighting by the mean of all weightings.
timeseries object 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.