CAD/CAM技术及应用
end
if eqsp
h = (xCol(n)-xCol(1))/(n-1);
end
else
h = 1;
eqsp = 1;
end
if any(h < 0)
[xCol,p] = sort(xCol);
yMat = yMat(p,:);
if eqsp
h = -h;
else
h = diff(xCol);
end
end
if any(h == 0)
error('MATLAB:interp1:RepeatedValuesX', ...
'The values of X should be distinct.');
end
% PP = INTERP1(X,Y,METHOD,'pp')
if nargin==4 && ischar(varargin{3}) && isequal('pp',varargin{4})
% obtain pp form of output
pp = ppinterp;
varargout{1} = pp;
return
end
% Interpolate
numelXi = length(xiCol);
p = [];
switch method(1)
case 's' % 'spline'
% spline is oriented opposite to interp1
yiMat = spline(xCol.',yMat.',xiCol.').';
case {'c','p'} % 'cubic' or 'pchip'
% pchip is oriented opposite to interp1
yiMat = pchip(xCol.',yMat.',xiCol.').';