Functions | |
switch (nargin) case 1 Z | |
case | if (ischar(varargin{2}))[Z |
endif case | if (ischar(varargin{3}))[Z |
endif case | if (ischar(varargin{4}))[Z |
otherwise | print_usage () |
endswitch | if (!ismatrix(Z)) error("interp2 expected matrix Z") |
endif | if (!isempty(n)&&!isscalar(n)) error("interp2 expected scalar n") |
endif | if (!ischar(method)) error("interp2 expected string 'method'") |
endif | if (ischar(extrapval)||strcmp(extrapval,"extrap")) extrapval |
elseif (!isscalar(extrapval)) error("interp2 expected n extrapval") | |
if (isempty(X)) X | |
endif | if (!isnumeric(X)||!isnumeric(Y)) error("interp2 expected numeric X |
endif | if (!isempty(n)) p |
endif | if (!isnumeric(XI)||!isnumeric(YI)) error("interp2 expected numeric XI |
endif | if (strcmp(method,"linear")||strcmp(method,"nearest")...||strcmp(method,"pchip")) if(isvector(X)&&isvector(Y)) X |
elseif (size_equal(X, Y)) X | |
else | error ("X and Y must be matrices of same size") |
endif | if (columns(Z)!=length(X)||rows(Z)!=length(Y)) error("X and Y size must match Z dimensions") |
endif | if ((rows(XI)==1 &&columns(YI)==1)||(columns(XI)==1 &&rows(YI)==1))[XI |
elseif (!size_equal(XI, YI)) error("XI and YI must be matrices of same size") | |
Variables | |
function | ZI |
method = "linear" | |
extrapval = NA | |
else [Z, n] = deal (varargin{:}) | |
endif case | n |
endif case | XI = (p:p*zc)/p |
endif case | YI = (p:p*zr)'/p |
endif | case [X, Y, Z, XI, YI, method] = deal (varargin{:}) |
endif [zr, zc] = size (Z) | |
Y = 1:zr |
elseif | ( | ! | size_equalXI, YI | ) |
elseif | ( | size_equal(X, Y) | ) |
elseif | ( | ! | isscalarextrapval | ) |
endif if | ( | (rows(XI)==1 &&columns(YI)==1)||(columns(XI)==1 &&rows(YI)==1) | ) |
endif if | ( | ! | isnumericXI)||!isnumeric(YI | ) |
endif if | ( | ! | isemptyn | ) |
endif if | ( | ! | isnumericX)||!isnumeric(Y | ) |
if | ( | isempty(X) | ) |
endif if | ( | ! | ischarmethod | ) |
endif if | ( | ! | isemptyn)&&!isscalar(n | ) |
endswitch if | ( | ! | ismatrixZ | ) |
endif case if | ( | ischar(varargin{4}) | ) |
endif case if | ( | ischar(varargin{3}) | ) |
case if | ( | ischar(varargin{2}) | ) |
otherwise print_usage | ( | ) |
switch | ( | nargin | ) |
switch(ext case = deal (varargin{:}) |
endif case n |
XI = (p:p*zc)/p |
Y = 1:zr |