| MATLAB® | ![]() |
tsc = resample(tsc,Time)
tsc = resample(tsc,Time,interp_method)
tsc = resample(tsc,Time,interp_method,code)
tsc = resample(tsc,Time) resamples the tscollection object tsc on the new Time vector. When tsc uses date strings and Time is numeric, Time is treated as numerical specified relative to the tsc.TimeInfo.StartDate property and in the same units that tsc uses. The resample method uses the default interpolation method for each time series member.
tsc = resample(tsc,Time,interp_method) resamples the tscollection object tsc using the interpolation method given by the string interp_method. Valid interpolation methods include 'linear' and 'zoh' (zero-order hold).
tsc = resample(tsc,Time,interp_method,code) resamples the tscollection object tsc using the interpolation method given by the string interp_method. The integer code is a user-defined quality code for resampling, applied to all samples.
The following example shows how to resample a tscollection that consists of two timeseries members.
Create two timeseries objects.
ts1=timeseries([1.1 2.9 3.7 4.0 3.0],1:5,'name','acceleration'); ts2=timeseries([3.2 4.2 6.2 8.5 1.1],1:5,'name','speed');
tsc=tscollection({ts1 ts2});
The time vector of the collection tsc is [1:5], which is the same as for ts1 and ts2 (individually).
Get the interpolation method for acceleration by typing
tsc.acceleration
MATLAB responds with
Time Series Object: acceleration
Time vector characteristics
Length 5
Start time 1 seconds
End time 5 seconds
Data characteristics
Interpolation method linear
Size [1 1 5]
Data type double
Set the interpolation method for speed to zero-order hold by typing
setinterpmethod(tsc.speed,'zoh')
MATLAB responds with
Time Series Object: acceleration
Time vector characteristics
Length 5
Start time 1 seconds
End time 5 seconds
Data characteristics
Interpolation method zoh
Size [1 1 5]
Data type double
Resample the time-series collection tsc by individually resampling each time-series member of the collection and using its interpolation method.
res_tsc=resample(tsc,[1 1.5 3.5 4.5 4.9])
getinterpmethod, setinterpmethod, tscollection
![]() | resample (timeseries) | reset | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |