setinterpmethod
Class:timeseries
Set default interpolation method fortimeseries
object
Syntax
ts = setinterpmethod(ts, method)
ts = setinterpmethod(ts, fhandle)
ts = setinterpmethod(ts, interpobj)
Description
sets the default interpolation method,ts
= setinterpmethod(ts
,method
)method
, fortimeseries
object,ts
, and outputs it tots1
.
sets the default interpolation method forts
= setinterpmethod(ts
,fhandle
)timeseries
objectts
, wherefhandle
is a function handle to the interpolation method.
sets the default interpolation method forts
= setinterpmethod(ts
,interpobj
)timeseries
objectts
, whereinterpobj
is atsdata.interpolation
object that directly replaces the interpolation object stored ints
.
Input Arguments
|
The |
|
A string specifying the interpolation method. Valid values are Default: |
|
A function handle to the interpolation method. The order of input arguments defining the function handle must be |
|
A |
Output Arguments
|
The |
Examples
Set the default interpolation method fortimeseries
objectts
to zero order hold:
ts = timeseries(rand(100,1),1:100); ts = setinterpmethod(ts,'zoh'); plot(ts);
Set the default interpolation method fortimeseries
objectts
, wherefhandle
is a function handle to the interpolation method defined by function handlemyFuncHandle
:
ts = timeseries(rand(100,1),1:100); myFuncHandle = @(new_time, time, data)... interp1(time, data, new_time,... 'linear','extrap'); ts = setinterpmethod(ts, myFuncHandle); ts = resample(ts, [-5:0.1:10]); plot(ts);
Set the default interpolation method fortimeseries
objectts
to atsdata.interpolation
object:
ts = timeseries(rand(100,1),1:100); myFuncHandle = @(new_time, time, data)... interp1(time, data, new_time,... 'linear','extrap'); myInterpObj = tsdata.interpolation(myFuncHandle); ts = setinterpmethod(ts,myInterpObj); plot(ts);
Tips
This method is case sensitive.