帮助中心帮助中心
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
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office