CAD/CAM技术及应用
% Process X in INTERP1(X,Y,...), or supply default for INTERP1(Y,...)
if xOffset
x = varargin{xOffset};
if ~isvector(x)
error('MATLAB:interp1:Xvector','X must be a vector.');
end
if length(x) ~= n
if isvector(y)
error('MATLAB:interp1:YInvalidNumRows', ...
'X and Y must be of the same length.')
else
error('MATLAB:interp1:YInvalidNumRows', ...
'LENGTH(X) and SIZE(Y,1) must be the same.');
end
end
% Prefer column vectors for x
xCol = x(:);
else
xCol = (1:n)';
end
% Process XI in INTERP1(Y,XI,...) and INTERP1(X,Y,XI,...)
% Avoid syntax PP = INTERP1(X,Y,METHOD,'pp')
if ~ppOutput
xi = varargin{2+xOffset};
siz_xi = size(xi);
% xi may be an ND array, but flatten it to a column vector xiCol
xiCol = xi(:);
% The size of the output YI
if isvector(y)
% Y is a vector so size(YI) == size(XI)
siz_yi = siz_xi;
else
if isvector(xi)
% Y is not a vector but XI is
siz_yi = [length(xi) ds];
else
% Both Y and XI are non-vectors
siz_yi = [siz_xi ds];
end
end
end