CAD/CAM技术及应用
2.编程:
xOffset = 1;
if (nargin==2) || ...
(nargin==3 && ischar(varargin{3})) || ...
(nargin==4 && (~ischar(varargin{4}) || strcmp(varargin{4}, 'extrap')));
end
% Process Y in INTERP1(Y,...) and INTERP1(X,Y,...)
y = varargin{1+xOffset};
siz_y = size(y);
% y may be an ND array, but collapse it down to a 2D yMat. If yMat is
% a vector, it is a column vector.
if isvector(y)
if size(y,1) == 1
% Prefer column vectors for y
yMat = y.';
n = siz_y(2);
else
yMat = y;
n = siz_y(1);
end
ds = 1;
prodDs = 1;
else
n = siz_y(1);
ds = siz_y(2:end);
prodDs = prod(ds);
yMat = reshape(y,[n prodDs]);
end