Mercurial > hg > octave-nkf
annotate scripts/general/interpn.m @ 20076:781adfc2958c draft obsolete nkf
Build qt graphics toolkit menus with uimenu
* libgui/graphics/Figure.cc, libgui/graphics/Figure.h: Revert cset 7335cc071ab0
and remove all menu items.
* scripts/gui/private/__get_funcname__.m: Fix typo
* scripts/plot/util/private/__add_default_menu__.m: Enable uimenu for qt
graphics toolkit and fix setting pan/rotate/zoom for qt and fltk
author | Stefan Mahr <dac922@gmx.de> |
---|---|
date | Fri, 27 Feb 2015 18:36:05 +0100 |
parents | 9fc020886ae9 |
children | 7503499a252b |
rev | line source |
---|---|
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19859
diff
changeset
|
1 ## Copyright (C) 2007-2015 David Bateman |
6702 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
6702 | 9 ## |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
6702 | 18 |
19 ## -*- texinfo -*- | |
10846
a4f482e66b65
Grammarcheck more of the documentation.
Rik <octave@nomad.inbox5.com>
parents:
10821
diff
changeset
|
20 ## @deftypefn {Function File} {@var{vi} =} interpn (@var{x1}, @var{x2}, @dots{}, @var{v}, @var{y1}, @var{y2}, @dots{}) |
6702 | 21 ## @deftypefnx {Function File} {@var{vi} =} interpn (@var{v}, @var{y1}, @var{y2}, @dots{}) |
22 ## @deftypefnx {Function File} {@var{vi} =} interpn (@var{v}, @var{m}) | |
23 ## @deftypefnx {Function File} {@var{vi} =} interpn (@var{v}) | |
24 ## @deftypefnx {Function File} {@var{vi} =} interpn (@dots{}, @var{method}) | |
25 ## @deftypefnx {Function File} {@var{vi} =} interpn (@dots{}, @var{method}, @var{extrapval}) | |
26 ## | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
27 ## Perform @var{n}-dimensional interpolation, where @var{n} is at least two. |
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
28 ## Each element of the @var{n}-dimensional array @var{v} represents a value |
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
29 ## at a location given by the parameters @var{x1}, @var{x2}, @dots{}, @var{xn}. |
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
30 ## The parameters @var{x1}, @var{x2}, @dots{}, @var{xn} are either |
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
31 ## @var{n}-dimensional arrays of the same size as the array @var{v} in |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16891
diff
changeset
|
32 ## the @qcode{"ndgrid"} format or vectors. The parameters @var{y1}, etc. |
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16891
diff
changeset
|
33 ## respect a similar format to @var{x1}, etc., and they represent the points |
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16891
diff
changeset
|
34 ## at which the array @var{vi} is interpolated. |
6702 | 35 ## |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
36 ## If @var{x1}, @dots{}, @var{xn} are omitted, they are assumed to be |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
37 ## @code{x1 = 1 : size (@var{v}, 1)}, etc. If @var{m} is specified, then |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
38 ## the interpolation adds a point half way between each of the interpolation |
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
39 ## points. This process is performed @var{m} times. If only @var{v} is |
6702 | 40 ## specified, then @var{m} is assumed to be @code{1}. |
41 ## | |
19859
5a59c0e1203d
Modified the "extrap" option for interp2, interp3, and interpn (bug #44002).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
18722
diff
changeset
|
42 ## The interpolation @var{method} is one of: |
6702 | 43 ## |
44 ## @table @asis | |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16891
diff
changeset
|
45 ## @item @qcode{"nearest"} |
9070
e9dc2ed2ec0f
Cleanup documentation for poly.texi, interp.texi, geometry.texi
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
46 ## Return the nearest neighbor. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10819
diff
changeset
|
47 ## |
19859
5a59c0e1203d
Modified the "extrap" option for interp2, interp3, and interpn (bug #44002).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
18722
diff
changeset
|
48 ## @item @qcode{"linear"} (default) |
9070
e9dc2ed2ec0f
Cleanup documentation for poly.texi, interp.texi, geometry.texi
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
49 ## Linear interpolation from nearest neighbors. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10819
diff
changeset
|
50 ## |
19859
5a59c0e1203d
Modified the "extrap" option for interp2, interp3, and interpn (bug #44002).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
18722
diff
changeset
|
51 ## @item @qcode{"pchip"} |
5a59c0e1203d
Modified the "extrap" option for interp2, interp3, and interpn (bug #44002).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
18722
diff
changeset
|
52 ## Piecewise cubic Hermite interpolating polynomial---shape-preserving |
5a59c0e1203d
Modified the "extrap" option for interp2, interp3, and interpn (bug #44002).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
18722
diff
changeset
|
53 ## interpolation with smooth first derivative (not implemented yet). |
5a59c0e1203d
Modified the "extrap" option for interp2, interp3, and interpn (bug #44002).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
18722
diff
changeset
|
54 ## |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16891
diff
changeset
|
55 ## @item @qcode{"cubic"} |
19859
5a59c0e1203d
Modified the "extrap" option for interp2, interp3, and interpn (bug #44002).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
18722
diff
changeset
|
56 ## Cubic interpolation (same as @qcode{"pchip"} [not implemented yet]). |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10819
diff
changeset
|
57 ## |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16891
diff
changeset
|
58 ## @item @qcode{"spline"} |
12175
2090995ca588
Correct en-dash,em-dash instances in docstrings.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
59 ## Cubic spline interpolation---smooth first and second derivatives |
6702 | 60 ## throughout the curve. |
61 ## @end table | |
62 ## | |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16891
diff
changeset
|
63 ## The default method is @qcode{"linear"}. |
6702 | 64 ## |
20000
ca7599ae464d
doc: Grammarcheck documentation ahead of 4.0 release.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
65 ## @var{extrapval} is a scalar number. It replaces values beyond the endpoints |
19859
5a59c0e1203d
Modified the "extrap" option for interp2, interp3, and interpn (bug #44002).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
18722
diff
changeset
|
66 ## with @var{extrapval}. Note that if @var{extrapval} is used, @var{method} |
5a59c0e1203d
Modified the "extrap" option for interp2, interp3, and interpn (bug #44002).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
18722
diff
changeset
|
67 ## must be specified as well. If @var{extrapval} is omitted and the |
5a59c0e1203d
Modified the "extrap" option for interp2, interp3, and interpn (bug #44002).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
18722
diff
changeset
|
68 ## @var{method} is @qcode{"spline"}, then the extrapolated values of the |
5a59c0e1203d
Modified the "extrap" option for interp2, interp3, and interpn (bug #44002).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
18722
diff
changeset
|
69 ## @qcode{"spline"} are used. Otherwise the default @var{extrapval} value for |
5a59c0e1203d
Modified the "extrap" option for interp2, interp3, and interpn (bug #44002).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
18722
diff
changeset
|
70 ## any other @var{method} is @qcode{"NA"}. |
5a59c0e1203d
Modified the "extrap" option for interp2, interp3, and interpn (bug #44002).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
18722
diff
changeset
|
71 ## @seealso{interp1, interp2, interp3, spline, ndgrid} |
6702 | 72 ## @end deftypefn |
73 | |
74 function vi = interpn (varargin) | |
75 | |
76 method = "linear"; | |
19859
5a59c0e1203d
Modified the "extrap" option for interp2, interp3, and interpn (bug #44002).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
18722
diff
changeset
|
77 extrapval = []; |
6702 | 78 nargs = nargin; |
79 | |
13151 | 80 if (nargin < 1 || ! isnumeric (varargin{1})) |
6702 | 81 print_usage (); |
82 endif | |
83 | |
19859
5a59c0e1203d
Modified the "extrap" option for interp2, interp3, and interpn (bug #44002).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
18722
diff
changeset
|
84 if (nargs > 1 && ischar (varargin{end-1})) |
7208 | 85 if (! isnumeric (varargin{end}) || ! isscalar (varargin{end})) |
19859
5a59c0e1203d
Modified the "extrap" option for interp2, interp3, and interpn (bug #44002).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
18722
diff
changeset
|
86 error ("interpn: EXTRAPVAL must be a numeric scalar"); |
6702 | 87 endif |
8116 | 88 extrapval = varargin{end}; |
19859
5a59c0e1203d
Modified the "extrap" option for interp2, interp3, and interpn (bug #44002).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
18722
diff
changeset
|
89 method = varargin{end-1}; |
16891
486c3e2731ff
interpn.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
90 nargs -= 2; |
19859
5a59c0e1203d
Modified the "extrap" option for interp2, interp3, and interpn (bug #44002).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
18722
diff
changeset
|
91 elseif (ischar (varargin{end})) |
5a59c0e1203d
Modified the "extrap" option for interp2, interp3, and interpn (bug #44002).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
18722
diff
changeset
|
92 method = varargin{end}; |
5a59c0e1203d
Modified the "extrap" option for interp2, interp3, and interpn (bug #44002).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
18722
diff
changeset
|
93 nargs--; |
6702 | 94 endif |
95 | |
18722
5cf9a02732b6
Issue warning when '*' flag used with interp2,3,n.m (bug #41459).
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
96 if (method(1) == "*") |
5cf9a02732b6
Issue warning when '*' flag used with interp2,3,n.m (bug #41459).
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
97 warning ("interpn: ignoring unsupported '*' flag to METHOD"); |
5cf9a02732b6
Issue warning when '*' flag used with interp2,3,n.m (bug #41459).
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
98 method(1) = []; |
5cf9a02732b6
Issue warning when '*' flag used with interp2,3,n.m (bug #41459).
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
99 endif |
19859
5a59c0e1203d
Modified the "extrap" option for interp2, interp3, and interpn (bug #44002).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
18722
diff
changeset
|
100 method = validatestring (method, ... |
5a59c0e1203d
Modified the "extrap" option for interp2, interp3, and interpn (bug #44002).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
18722
diff
changeset
|
101 {"nearest", "linear", "pchip", "cubic", "spline"}); |
18722
5cf9a02732b6
Issue warning when '*' flag used with interp2,3,n.m (bug #41459).
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
102 |
6702 | 103 if (nargs < 3) |
7208 | 104 v = varargin{1}; |
6702 | 105 m = 1; |
106 if (nargs == 2) | |
13151 | 107 if (ischar (varargin{2})) |
108 method = varargin{2}; | |
13161
6b6d0e51bd2f
scripts/general/interpn.m: fix(m)==m is faster than round(m)==m
Ben Abbott <bpabbott@mac.com>
parents:
13151
diff
changeset
|
109 elseif (isnumeric (m) && isscalar (m) && fix (m) == m) |
13151 | 110 m = varargin{2}; |
111 else | |
112 print_usage (); | |
6702 | 113 endif |
114 endif | |
115 sz = size (v); | |
116 nd = ndims (v); | |
117 x = cell (1, nd); | |
118 y = cell (1, nd); | |
16891
486c3e2731ff
interpn.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
119 for i = 1 : nd |
6702 | 120 x{i} = 1 : sz(i); |
121 y{i} = 1 : (1 / (2 ^ m)) : sz(i); | |
122 endfor | |
13151 | 123 y{1} = y{1}.'; |
124 [y{:}] = ndgrid (y{:}); | |
7208 | 125 elseif (! isvector (varargin{1}) && nargs == (ndims (varargin{1}) + 1)) |
126 v = varargin{1}; | |
6702 | 127 sz = size (v); |
128 nd = ndims (v); | |
129 x = cell (1, nd); | |
16891
486c3e2731ff
interpn.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
130 y = varargin(2 : nargs); |
486c3e2731ff
interpn.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
131 for i = 1 : nd |
6702 | 132 x{i} = 1 : sz(i); |
133 endfor | |
16891
486c3e2731ff
interpn.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
134 elseif (rem (nargs, 2) == 1 |
486c3e2731ff
interpn.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
135 && nargs == (2 * ndims (varargin{ceil (nargs / 2)})) + 1) |
6702 | 136 nv = ceil (nargs / 2); |
7208 | 137 v = varargin{nv}; |
6702 | 138 sz = size (v); |
139 nd = ndims (v); | |
16891
486c3e2731ff
interpn.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
140 x = varargin(1 : (nv - 1)); |
486c3e2731ff
interpn.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
141 y = varargin((nv + 1) : nargs); |
6702 | 142 else |
10635
d1978e7364ad
Print name of function in error() string messages.
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
143 error ("interpn: wrong number or incorrectly formatted input arguments"); |
6702 | 144 endif |
145 | |
12931
cefd568ea073
Replace function handles with function names in cellfun calls for 15% speedup.
Rik <octave@nomad.inbox5.com>
parents:
12175
diff
changeset
|
146 if (any (! cellfun ("isvector", x))) |
6702 | 147 for i = 2 : nd |
148 if (! size_equal (x{1}, x{i}) || ! size_equal (x{i}, v)) | |
10635
d1978e7364ad
Print name of function in error() string messages.
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
149 error ("interpn: dimensional mismatch"); |
6702 | 150 endif |
16891
486c3e2731ff
interpn.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
151 idx(1 : nd) = {1}; |
486c3e2731ff
interpn.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
152 idx(i) = ":"; |
6721 | 153 x{i} = x{i}(idx{:})(:); |
6702 | 154 endfor |
16891
486c3e2731ff
interpn.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
155 idx(1 : nd) = {1}; |
486c3e2731ff
interpn.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
156 idx(1) = ":"; |
6721 | 157 x{1} = x{1}(idx{:})(:); |
6702 | 158 endif |
159 | |
7421 | 160 method = tolower (method); |
6702 | 161 |
12931
cefd568ea073
Replace function handles with function names in cellfun calls for 15% speedup.
Rik <octave@nomad.inbox5.com>
parents:
12175
diff
changeset
|
162 all_vectors = all (cellfun ("isvector", y)); |
cefd568ea073
Replace function handles with function names in cellfun calls for 15% speedup.
Rik <octave@nomad.inbox5.com>
parents:
12175
diff
changeset
|
163 different_lengths = numel (unique (cellfun ("numel", y))) > 1; |
10819
f3c984d45dcb
interpn.m: Convert interpolation vectors of non-equal length to nd-arrays.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
164 if (all_vectors && different_lengths) |
f3c984d45dcb
interpn.m: Convert interpolation vectors of non-equal length to nd-arrays.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
165 [foobar(1:numel(y)).y] = ndgrid (y{:}); |
f3c984d45dcb
interpn.m: Convert interpolation vectors of non-equal length to nd-arrays.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
166 y = {foobar.y}; |
f3c984d45dcb
interpn.m: Convert interpolation vectors of non-equal length to nd-arrays.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
167 endif |
f3c984d45dcb
interpn.m: Convert interpolation vectors of non-equal length to nd-arrays.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
168 |
6702 | 169 if (strcmp (method, "linear")) |
170 vi = __lin_interpn__ (x{:}, v, y{:}); | |
19859
5a59c0e1203d
Modified the "extrap" option for interp2, interp3, and interpn (bug #44002).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
18722
diff
changeset
|
171 if (isempty (extrapval)) |
5a59c0e1203d
Modified the "extrap" option for interp2, interp3, and interpn (bug #44002).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
18722
diff
changeset
|
172 extrapval = NA; |
5a59c0e1203d
Modified the "extrap" option for interp2, interp3, and interpn (bug #44002).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
18722
diff
changeset
|
173 endif |
16891
486c3e2731ff
interpn.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
174 vi(isna (vi)) = extrapval; |
6702 | 175 elseif (strcmp (method, "nearest")) |
176 yshape = size (y{1}); | |
177 yidx = cell (1, nd); | |
178 for i = 1 : nd | |
179 y{i} = y{i}(:); | |
7671
4fbaba9abec1
implement compiled binary lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7561
diff
changeset
|
180 yidx{i} = lookup (x{i}, y{i}, "lr"); |
6702 | 181 endfor |
182 idx = cell (1,nd); | |
183 for i = 1 : nd | |
20038
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
20000
diff
changeset
|
184 idx{i} = yidx{i} ... |
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
20000
diff
changeset
|
185 + (y{i} - x{i}(yidx{i})(:) >= x{i}(yidx{i} + 1)(:) - y{i}); |
6702 | 186 endfor |
16891
486c3e2731ff
interpn.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
187 vi = v(sub2ind (sz, idx{:})); |
10819
f3c984d45dcb
interpn.m: Convert interpolation vectors of non-equal length to nd-arrays.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
188 idx = zeros (prod (yshape), 1); |
6702 | 189 for i = 1 : nd |
190 idx |= y{i} < min (x{i}(:)) | y{i} > max (x{i}(:)); | |
191 endfor | |
19859
5a59c0e1203d
Modified the "extrap" option for interp2, interp3, and interpn (bug #44002).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
18722
diff
changeset
|
192 if (isempty (extrapval)) |
5a59c0e1203d
Modified the "extrap" option for interp2, interp3, and interpn (bug #44002).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
18722
diff
changeset
|
193 extrapval = NA; |
5a59c0e1203d
Modified the "extrap" option for interp2, interp3, and interpn (bug #44002).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
18722
diff
changeset
|
194 endif |
6702 | 195 vi(idx) = extrapval; |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
196 vi = reshape (vi, yshape); |
6721 | 197 elseif (strcmp (method, "spline")) |
12931
cefd568ea073
Replace function handles with function names in cellfun calls for 15% speedup.
Rik <octave@nomad.inbox5.com>
parents:
12175
diff
changeset
|
198 if (any (! cellfun ("isvector", y))) |
7423 | 199 for i = 2 : nd |
10549 | 200 if (! size_equal (y{1}, y{i})) |
10635
d1978e7364ad
Print name of function in error() string messages.
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
201 error ("interpn: dimensional mismatch"); |
10549 | 202 endif |
16891
486c3e2731ff
interpn.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
203 idx(1 : nd) = {1}; |
486c3e2731ff
interpn.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
204 idx(i) = ":"; |
10549 | 205 y{i} = y{i}(idx{:}); |
7423 | 206 endfor |
16891
486c3e2731ff
interpn.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
207 idx(1 : nd) = {1}; |
486c3e2731ff
interpn.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
208 idx(1) = ":"; |
7423 | 209 y{1} = y{1}(idx{:}); |
210 endif | |
7421 | 211 |
6702 | 212 vi = __splinen__ (x, v, y, extrapval, "interpn"); |
7421 | 213 |
7423 | 214 if (size_equal (y{:})) |
215 ly = length (y{1}); | |
216 idx = cell (1, ly); | |
217 q = cell (1, nd); | |
218 for i = 1 : ly | |
10549 | 219 q(:) = i; |
16891
486c3e2731ff
interpn.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
220 idx{i} = q; |
7423 | 221 endfor |
16891
486c3e2731ff
interpn.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
222 vi = vi(cellfun (@(x) sub2ind (size (vi), x{:}), idx)); |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14363
diff
changeset
|
223 vi = reshape (vi, size (y{1})); |
7423 | 224 endif |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
225 elseif (strcmp (method, "cubic")) |
10635
d1978e7364ad
Print name of function in error() string messages.
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
226 error ("interpn: cubic interpolation not yet implemented"); |
6702 | 227 else |
11472
1740012184f9
Use uppercase for variable names in error() strings to match Info documentation. Only m-files done.
Rik <octave@nomad.inbox5.com>
parents:
10846
diff
changeset
|
228 error ("interpn: unrecognized interpolation METHOD"); |
6702 | 229 endif |
230 | |
231 endfunction | |
232 | |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
233 |
6702 | 234 %!demo |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
235 %! clf; |
14247
c4fa5e0b6193
test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
236 %! colormap ("default"); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
237 %! A = [13,-1,12;5,4,3;1,6,2]; |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14359
diff
changeset
|
238 %! x = [0,1,4]; y = [10,11,12]; |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14359
diff
changeset
|
239 %! xi = linspace (min (x), max (x), 17); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14359
diff
changeset
|
240 %! yi = linspace (min (y), max (y), 26)'; |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
241 %! mesh (xi, yi, interpn (x,y,A.',xi,yi, "linear").'); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
242 %! [x,y] = meshgrid (x,y); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
243 %! hold on; plot3 (x(:),y(:),A(:),"b*"); hold off; |
6702 | 244 |
245 %!demo | |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
246 %! clf; |
14247
c4fa5e0b6193
test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
247 %! colormap ("default"); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
248 %! A = [13,-1,12;5,4,3;1,6,2]; |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14359
diff
changeset
|
249 %! x = [0,1,4]; y = [10,11,12]; |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14359
diff
changeset
|
250 %! xi = linspace (min (x), max (x), 17); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14359
diff
changeset
|
251 %! yi = linspace (min (y), max (y), 26)'; |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
252 %! mesh (xi, yi, interpn (x,y,A.',xi,yi, "nearest").'); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
253 %! [x,y] = meshgrid (x,y); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
254 %! hold on; plot3 (x(:),y(:),A(:),"b*"); hold off; |
6702 | 255 |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
256 %!#demo # FIXME: Uncomment when support for "cubic" has been added |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
257 %! clf; |
14247
c4fa5e0b6193
test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
258 %! colormap ("default"); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
259 %! A = [13,-1,12;5,4,3;1,6,2]; |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14359
diff
changeset
|
260 %! x = [0,1,2]; y = [10,11,12]; |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14359
diff
changeset
|
261 %! xi = linspace (min (x), max (x), 17); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14359
diff
changeset
|
262 %! yi = linspace (min (y), max (y), 26)'; |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
263 %! mesh (xi, yi, interpn (x,y,A.',xi,yi, "cubic").'); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
264 %! [x,y] = meshgrid (x,y); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
265 %! hold on; plot3 (x(:),y(:),A(:),"b*"); hold off; |
6702 | 266 |
267 %!demo | |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
268 %! clf; |
14247
c4fa5e0b6193
test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
269 %! colormap ("default"); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
270 %! A = [13,-1,12;5,4,3;1,6,2]; |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14359
diff
changeset
|
271 %! x = [0,1,2]; y = [10,11,12]; |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14359
diff
changeset
|
272 %! xi = linspace (min (x), max (x), 17); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14359
diff
changeset
|
273 %! yi = linspace (min (y), max (y), 26)'; |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
274 %! mesh (xi, yi, interpn (x,y,A.',xi,yi, "spline").'); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
275 %! [x,y] = meshgrid (x,y); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
276 %! hold on; plot3 (x(:),y(:),A(:),"b*"); hold off; |
6721 | 277 |
278 %!demo | |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
279 %! clf; |
14247
c4fa5e0b6193
test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
280 %! colormap ("default"); |
6721 | 281 %! x = y = z = -1:1; |
282 %! f = @(x,y,z) x.^2 - y - z.^2; | |
283 %! [xx, yy, zz] = meshgrid (x, y, z); | |
284 %! v = f (xx,yy,zz); | |
285 %! xi = yi = zi = -1:0.1:1; | |
286 %! [xxi, yyi, zzi] = ndgrid (xi, yi, zi); | |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14359
diff
changeset
|
287 %! vi = interpn (x, y, z, v, xxi, yyi, zzi, "spline"); |
6721 | 288 %! mesh (yi, zi, squeeze (vi(1,:,:))); |
289 | |
7421 | 290 %!test |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
291 %! [x,y,z] = ndgrid (0:2); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
292 %! f = x + y + z; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
293 %! assert (interpn (x,y,z,f,[.5 1.5],[.5 1.5],[.5 1.5]), [1.5, 4.5]); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
294 %! assert (interpn (x,y,z,f,[.51 1.51],[.51 1.51],[.51 1.51],"nearest"), [3, 6]); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
295 %! assert (interpn (x,y,z,f,[.5 1.5],[.5 1.5],[.5 1.5],"spline"), [1.5, 4.5]); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
296 %! assert (interpn (x,y,z,f,x,y,z), f); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
297 %! assert (interpn (x,y,z,f,x,y,z,"nearest"), f); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
298 %! assert (interpn (x,y,z,f,x,y,z,"spline"), f); |
7561
a938cd7869b2
__lin_interpn__.cc: handle decreasing coordinate values
Alexander Barth
parents:
7424
diff
changeset
|
299 |
a938cd7869b2
__lin_interpn__.cc: handle decreasing coordinate values
Alexander Barth
parents:
7424
diff
changeset
|
300 %!test |
10819
f3c984d45dcb
interpn.m: Convert interpolation vectors of non-equal length to nd-arrays.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
301 %! [x, y, z] = ndgrid (0:2, 1:4, 2:6); |
f3c984d45dcb
interpn.m: Convert interpolation vectors of non-equal length to nd-arrays.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
302 %! f = x + y + z; |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
303 %! xi = [0.5 1.0 1.5]; yi = [1.5 2.0 2.5 3.5]; zi = [2.5 3.5 4.0 5.0 5.5]; |
10819
f3c984d45dcb
interpn.m: Convert interpolation vectors of non-equal length to nd-arrays.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
304 %! fi = interpn (x, y, z, f, xi, yi, zi); |
f3c984d45dcb
interpn.m: Convert interpolation vectors of non-equal length to nd-arrays.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
305 %! [xi, yi, zi] = ndgrid (xi, yi, zi); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
306 %! assert (fi, xi + yi + zi); |
10819
f3c984d45dcb
interpn.m: Convert interpolation vectors of non-equal length to nd-arrays.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
307 |
f3c984d45dcb
interpn.m: Convert interpolation vectors of non-equal length to nd-arrays.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
308 %!test |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
309 %! xi = 0:2; yi = 1:4; zi = 2:6; |
10819
f3c984d45dcb
interpn.m: Convert interpolation vectors of non-equal length to nd-arrays.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
310 %! [x, y, z] = ndgrid (xi, yi, zi); |
f3c984d45dcb
interpn.m: Convert interpolation vectors of non-equal length to nd-arrays.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
311 %! f = x + y + z; |
f3c984d45dcb
interpn.m: Convert interpolation vectors of non-equal length to nd-arrays.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
312 %! fi = interpn (x, y, z, f, xi, yi, zi, "nearest"); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
313 %! assert (fi, x + y + z); |
10819
f3c984d45dcb
interpn.m: Convert interpolation vectors of non-equal length to nd-arrays.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
314 |
f3c984d45dcb
interpn.m: Convert interpolation vectors of non-equal length to nd-arrays.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
315 %!test |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
316 %! [x,y,z] = ndgrid (0:2); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
317 %! f = x.^2 + y.^2 + z.^2; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
318 %! assert (interpn (x,y,-z,f,1.5,1.5,-1.5), 7.5); |
10427
62bb59f927b1
scripts/general/interp2.m, scripts/general/interpn.m: For nearest neighbour interpolation ceil (instead of floor) at the center of the data intervals to be compatible with Matlab. Add test.
Soren Hauberg <hauberg@gmail.com>
parents:
9245
diff
changeset
|
319 |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
320 %!test # for Matlab-compatible rounding for "nearest" |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
321 %! x = meshgrid (1:4); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
322 %! assert (interpn (x, 2.5, 2.5, "nearest"), 3); |
10427
62bb59f927b1
scripts/general/interp2.m, scripts/general/interpn.m: For nearest neighbour interpolation ceil (instead of floor) at the center of the data intervals to be compatible with Matlab. Add test.
Soren Hauberg <hauberg@gmail.com>
parents:
9245
diff
changeset
|
323 |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
324 %!test |
13151 | 325 %! z = zeros (3, 3, 3); |
326 %! zout = zeros (5, 5, 5); | |
327 %! z(:,:,1) = [1 3 5; 3 5 7; 5 7 9]; | |
328 %! z(:,:,2) = z(:,:,1) + 2; | |
329 %! z(:,:,3) = z(:,:,2) + 2; | |
330 %! for n = 1:5 | |
331 %! zout(:,:,n) = [1 2 3 4 5; | |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
332 %! 2 3 4 5 6; |
13151 | 333 %! 3 4 5 6 7; |
334 %! 4 5 6 7 8; | |
335 %! 5 6 7 8 9] + (n-1); | |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
336 %! endfor |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
337 %! tol = 10*eps; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
338 %! assert (interpn (z), zout, tol); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
339 %! assert (interpn (z, "linear"), zout, tol); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
340 %! assert (interpn (z, "spline"), zout, tol); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
341 |
20038
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
20000
diff
changeset
|
342 ## Test input validation |
18722
5cf9a02732b6
Issue warning when '*' flag used with interp2,3,n.m (bug #41459).
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
343 %!warning <ignoring unsupported '\*' flag> interpn (rand (3,3), 1, "*linear"); |
5cf9a02732b6
Issue warning when '*' flag used with interp2,3,n.m (bug #41459).
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
344 |