timeseries.plus
timeseries: ts = plus (a, b)
The sum of series, a + b.
ts = plus (a, b) returns the sum of a and
b, sample by sample. One of them may be a number: a scalar, or an
array the size of one sample.
Two series must hold as many samples, of sizes the operator accepts,
at times in the same units. Two dated series must be at the same
instants; two undated ones may also differ by a constant offset, and
the result then takes the times of a, with a warning. A dated
series and an undated one are refused. The result is named
'unnamed' and takes its other properties from a, with the
events of both, no quality codes and linear interpolation;
DataInfo.Units is kept where both series have the same. With a
number, every property of the series is kept. The data is
double whatever its class.
See also: timeseries.minus, timeseries.times, timeseries.mtimes
Source Code: timeseries
The operators work sample by sample, between two series on the same times or between a series and a number. Units survive + and - and are dropped by products and quotients.
a = timeseries ([1; 2; 3], [0; 1; 2]); a.DataInfo.Units = 'm'; b = timeseries ([10; 20; 30], [0; 1; 2]); b.DataInfo.Units = 'm'; s = a + b; [s.Time, s.Data]
ans =
0 11
1 22
2 33
s.DataInfo.Units
ans = m
p = a .* b; p.DataInfo.Units
ans =