function tryon y=[2,3,4]; x=[1,2,3]; z=interp1(x,y,2.9,method,'extrap') 结果: ??? Undefined function or variable 'method'. 何故? 是 z=interp1(x,y,4,method,'extrap')
'nearest'Nearest neighbor interpolation 'linear'Linear interpolation (default) 'spline'Cubic spline interpolation 'pchip'Piecewise cubic Hermite interpolation 'cubic'(Same as 'pchip') 'v5cubic'Cubic interpolation used in MATLAB 5. This method does not extrapolate. Also, if x is not equally spaced, 'spline' is used 默认是linear,可以用[]代替本回答被提问者采纳