timeseries

Methods

Method Reference: timeseries.setinterpmethod

timeseries: ts = setinterpmethod (ts, name)

timeseries: ts = setinterpmethod (ts, fh)

timeseries: ts = setinterpmethod (ts, ip)

Set the interpolation method.

ts = setinterpmethod (ts, name) sets the method resample and synchronize use to name, 'linear' or 'zoh' (zero-order hold, keeping each value until the next sample), matched in any case and stored in lower case. MATLAB stores any name, 'cubic' included, and fails only on resampling; here another name is refused.

ts = setinterpmethod (ts, fh) sets a method evaluated by the function handle fh, called as MATLAB calls it: newData = fh (newTime, oldTime, oldData), with the times as columns and the data with time along its first dimension, so three-dimensional data is passed permuted.

ts = setinterpmethod (ts, ip) sets the method held by the tsdata.interpolation object ip.

See also: timeseries.getinterpmethod, timeseries.resample, tsdata.interpolation

Source Code: timeseries

The interpolation method says how the series behaves between samples, which resample and synchronize follow: 'linear' joins them, 'zoh' holds each value until the next sample.

 ts = timeseries ([0; 10; 20], [0; 1; 2]);
 s = resample (ts, 0:0.5:2);
 s.Data'
ans =

    0    5   10   15   20
 ts = setinterpmethod (ts, 'zoh');
 getinterpmethod (ts)
ans = zoh
 s = resample (ts, 0:0.5:2);
 s.Data'
ans =

    0    0   10   10   20