MATLAB 帮助中心
设置 timeseries 对象的默认插值方法
timeseries
ts = setinterpmethod(ts,interpmethod)
ts = setinterpmethod(ts,fun)
ts = setinterpmethod(ts,interpobj)
ts = setinterpmethod(ts,interpmethod) 设置 timeseries 对象的默认插值方法。如使用线性插值,interpmethod 为 'linear',如使用零阶保持,则为 'zoh'。
ts
interpmethod
'linear'
'zoh'
示例
ts = setinterpmethod(ts,fun) 使用函数句柄 fun 设置 ts 的默认插值方法。
fun
ts = setinterpmethod(ts,interpobj) 使用 tsdata.interpolation 对象 interpobj 替换 ts 中存储的插值对象。
interpobj
tsdata.interpolation
全部折叠
以三种方式设置 timeseries 对象的插值方法。
创建一个 timeseries 对象并将插值方法设置为零阶保持。
ts = timeseries(rand(100,1),1:100); ts = setinterpmethod(ts,'zoh'); plot(ts)
使用函数句柄设置默认插值方法。
fun = @(newtime,oldtime,olddata)... interp1(oldtime,olddata,newtime,... 'linear','extrap'); ts = setinterpmethod(ts,fun); plot(ts)
将默认插值方法设置为 tsdata.interpolation 对象。
interpobj = tsdata.interpolation(fun); ts = setinterpmethod(ts,interpobj); plot(ts)
输入 timeseries,指定为标量。
数据类型: timeseries
插值方法,指定为以下选项之一:
'linear' - 线性插值
'zoh' - 零阶保持
插值方法句柄,指定为定义插值方法的标量函数句柄。函数句柄的输入参量的顺序必须是 newtime、oldtime 和 olddata。单一输出参量必须包含插值数据。
newtime
oldtime
olddata
数据类型: function_handle
function_handle
插值对象,指定为一个 tsdata.interpolation 对象,它直接替换存储在 ts 中的插值对象。
在 R2006a 之前推出
timeseries | getinterpmethod
getinterpmethod
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处