Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

setinterpmethod - Set default interpolation method for timeseries object

Syntax

ts = setinterpmethod(ts,Method)
ts = setinterpmethod(ts,FHandle)
ts = setinterpmethod(ts,InterpObj),

Description

ts = setinterpmethod(ts,Method) sets the default interpolation method for timeseries object ts, where Method is a string. Method in ts. Method is either 'linear' or 'zoh' (zero-order hold). For example:

ts = timeseries(rand(100,1),1:100);
ts = setinterpmethod(ts,'zoh');

ts = setinterpmethod(ts,FHandle) sets the default interpolation method for timeseries object ts, where FHandle is a function handle to the interpolation method defined by the function handle FHandle. For example:

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);

ts = setinterpmethod(ts,InterpObj), where InterpObj is a tsdata.interpolation object that directly replaces the interpolation object stored in ts. For example:

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);

This method is case sensitive.

See Also

getinterpmethod, timeseries, tsprops

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS