CAD/CAM技术及应用
method = 'linear';
else
method = varargin{3};
end
else
if nargin >= 3+xOffset && ~isempty(varargin{3+xOffset})
method = varargin{3+xOffset};
else
method = 'linear';
end
end
% The v5 option, '*method', asserts that x is equally spaced.
eqsp = (method(1) == '*');
if eqsp
method(1) = [];
end
% INTERP1([X,]Y,XI,METHOD,'extrap') and INTERP1([X,]Y,Xi,METHOD,EXTRAPVAL) if ~ppOutput
if nargin >= 4+xOffset
extrapval = varargin{4+xOffset};
else
switch method(1)
case {'s','p','c'}
extrapval = 'extrap';
otherwise
extrapval = NaN;
end
end
end
% Start the algorithm
% We now have column vector xCol, column vector or 2D matrix yMat and
% column vector xiCol.
if xOffset
if ~eqsp
h = diff(xCol);
eqsp = (norm(diff(h),Inf) <= eps(norm(xCol,Inf)));
if any(~isfinite(xCol))
eqsp = 0; % if an INF in x, x is not equally spaced
end