Mercurial > hg > octave-nkf
annotate scripts/geometry/griddata.m @ 20305:c164cfc24bdd
QtHandles: add annotations dialog
* libgui/graphics/annotation-dialog.h: new file
* libgui/graphics/annotation-dialog.cc: new file
* libgui/graphics/annotation-dialog.ui: new file
* libgui/graphics/Canvas.cc
(canvasMousePressEvent): call annotation_dialog when in TextMode.
* libgui/graphics/module.mk: add annotation-dialog to build
author | John Donoghue <john.donoghue@ieee.org> |
---|---|
date | Sun, 19 Apr 2015 09:54:54 -0400 |
parents | 9fc020886ae9 |
children | 7503499a252b |
rev | line source |
---|---|
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19790
diff
changeset
|
1 ## Copyright (C) 1999-2015 Kai Habel |
6823 | 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. | |
6823 | 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/>. | |
6823 | 18 |
19 ## -*- texinfo -*- | |
14372
3f6489feca1e
griddata.m: Update docstring.
Rik <octave@nomad.inbox5.com>
parents:
14368
diff
changeset
|
20 ## @deftypefn {Function File} {@var{zi} =} griddata (@var{x}, @var{y}, @var{z}, @var{xi}, @var{yi}) |
3f6489feca1e
griddata.m: Update docstring.
Rik <octave@nomad.inbox5.com>
parents:
14368
diff
changeset
|
21 ## @deftypefnx {Function File} {@var{zi} =} griddata (@var{x}, @var{y}, @var{z}, @var{xi}, @var{yi}, @var{method}) |
3f6489feca1e
griddata.m: Update docstring.
Rik <octave@nomad.inbox5.com>
parents:
14368
diff
changeset
|
22 ## @deftypefnx {Function File} {[@var{xi}, @var{yi}, @var{zi}] =} griddata (@dots{}) |
10945
aa40bdbfa478
griddata.m: Allow x, y inputs to be vectors, and z a matrix.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
23 ## |
6823 | 24 ## Generate a regular mesh from irregular data using interpolation. |
25 ## The function is defined by @code{@var{z} = f (@var{x}, @var{y})}. | |
10945
aa40bdbfa478
griddata.m: Allow x, y inputs to be vectors, and z a matrix.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
26 ## Inputs @code{@var{x}, @var{y}, @var{z}} are vectors of the same length |
aa40bdbfa478
griddata.m: Allow x, y inputs to be vectors, and z a matrix.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
27 ## or @code{@var{x}, @var{y}} are vectors and @code{@var{z}} is matrix. |
aa40bdbfa478
griddata.m: Allow x, y inputs to be vectors, and z a matrix.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
28 ## |
6823 | 29 ## The interpolation points are all @code{(@var{xi}, @var{yi})}. If |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
30 ## @var{xi}, @var{yi} are vectors then they are made into a 2-D mesh. |
6823 | 31 ## |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
32 ## The interpolation method can be @qcode{"nearest"}, @qcode{"cubic"} or |
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
33 ## @qcode{"linear"}. If method is omitted it defaults to @qcode{"linear"}. |
14372
3f6489feca1e
griddata.m: Update docstring.
Rik <octave@nomad.inbox5.com>
parents:
14368
diff
changeset
|
34 ## @seealso{griddata3, griddatan, delaunay} |
6823 | 35 ## @end deftypefn |
36 | |
10549 | 37 ## Author: Kai Habel <kai.habel@gmx.de> |
6823 | 38 ## Adapted-by: Alexander Barth <barth.alexander@gmail.com> |
10945
aa40bdbfa478
griddata.m: Allow x, y inputs to be vectors, and z a matrix.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
39 ## xi and yi are not "meshgridded" if both are vectors |
6823 | 40 ## of the same size (for compatibility) |
41 | |
14368
5736d93b22d0
griddata.m: Accept vectors in any orientation (Bug #33539)
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
42 function [rx, ry, rz] = griddata (x, y, z, xi, yi, method = "linear") |
10945
aa40bdbfa478
griddata.m: Allow x, y inputs to be vectors, and z a matrix.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
43 |
aa40bdbfa478
griddata.m: Allow x, y inputs to be vectors, and z a matrix.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
44 if (nargin < 5 || nargin > 7) |
6826 | 45 print_usage (); |
6823 | 46 endif |
47 | |
6826 | 48 if (ischar (method)) |
49 method = tolower (method); | |
6823 | 50 endif |
10945
aa40bdbfa478
griddata.m: Allow x, y inputs to be vectors, and z a matrix.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
51 |
14368
5736d93b22d0
griddata.m: Accept vectors in any orientation (Bug #33539)
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
52 ## Meshgrid if x and y are vectors but z is matrix |
10945
aa40bdbfa478
griddata.m: Allow x, y inputs to be vectors, and z a matrix.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
53 if (isvector (x) && isvector (y) && all ([numel(y), numel(x)] == size (z))) |
aa40bdbfa478
griddata.m: Allow x, y inputs to be vectors, and z a matrix.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
54 [x, y] = meshgrid (x, y); |
14368
5736d93b22d0
griddata.m: Accept vectors in any orientation (Bug #33539)
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
55 endif |
19790
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
56 |
14368
5736d93b22d0
griddata.m: Accept vectors in any orientation (Bug #33539)
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
57 if (isvector (x) && isvector (y) && isvector (z)) |
5736d93b22d0
griddata.m: Accept vectors in any orientation (Bug #33539)
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
58 if (! isequal (length (x), length (y), length (z))) |
5736d93b22d0
griddata.m: Accept vectors in any orientation (Bug #33539)
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
59 error ("griddata: X, Y, and Z must be vectors of the same length"); |
10945
aa40bdbfa478
griddata.m: Allow x, y inputs to be vectors, and z a matrix.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
60 endif |
14368
5736d93b22d0
griddata.m: Accept vectors in any orientation (Bug #33539)
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
61 elseif (! size_equal (x, y, z)) |
5736d93b22d0
griddata.m: Accept vectors in any orientation (Bug #33539)
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
62 error ("griddata: lengths of X, Y must match the columns and rows of Z"); |
6823 | 63 endif |
10945
aa40bdbfa478
griddata.m: Allow x, y inputs to be vectors, and z a matrix.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
64 |
9677
8cf522ce9c4d
fix griddata with vectors
Jaroslav Hajek <highegg@gmail.com>
parents:
9501
diff
changeset
|
65 ## Meshgrid xi and yi if they are a row and column vector. |
8cf522ce9c4d
fix griddata with vectors
Jaroslav Hajek <highegg@gmail.com>
parents:
9501
diff
changeset
|
66 if (rows (xi) == 1 && columns (yi) == 1) |
6826 | 67 [xi, yi] = meshgrid (xi, yi); |
14368
5736d93b22d0
griddata.m: Accept vectors in any orientation (Bug #33539)
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
68 elseif (isvector (xi) && isvector (yi)) |
5736d93b22d0
griddata.m: Accept vectors in any orientation (Bug #33539)
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
69 ## Otherwise, convert to column vectors |
5736d93b22d0
griddata.m: Accept vectors in any orientation (Bug #33539)
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
70 xi = xi(:); |
5736d93b22d0
griddata.m: Accept vectors in any orientation (Bug #33539)
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
71 yi = yi(:); |
6823 | 72 endif |
73 | |
9677
8cf522ce9c4d
fix griddata with vectors
Jaroslav Hajek <highegg@gmail.com>
parents:
9501
diff
changeset
|
74 if (! size_equal (xi, yi)) |
11472
1740012184f9
Use uppercase for variable names in error() strings to match Info documentation. Only m-files done.
Rik <octave@nomad.inbox5.com>
parents:
10945
diff
changeset
|
75 error ("griddata: XI and YI must be vectors or matrices of same size"); |
6823 | 76 endif |
77 | |
9501 | 78 x = x(:); |
79 y = y(:); | |
80 z = z(:); | |
9495 | 81 |
8507 | 82 ## Triangulate data. |
6826 | 83 tri = delaunay (x, y); |
10548
479536c5bb10
Replace lowercase nan with NaN for visual cue in scripts
Rik <code@nomad.inbox5.com>
parents:
9677
diff
changeset
|
84 zi = NaN (size (xi)); |
10945
aa40bdbfa478
griddata.m: Allow x, y inputs to be vectors, and z a matrix.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
85 |
6826 | 86 if (strcmp (method, "cubic")) |
8664 | 87 error ("griddata: cubic interpolation not yet implemented"); |
6823 | 88 |
6826 | 89 elseif (strcmp (method, "nearest")) |
8507 | 90 ## Search index of nearest point. |
6826 | 91 idx = dsearch (x, y, tri, xi, yi); |
20038
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
92 valid = ! isnan (idx); |
6823 | 93 zi(valid) = z(idx(valid)); |
94 | |
6826 | 95 elseif (strcmp (method, "linear")) |
8507 | 96 ## Search for every point the enclosing triangle. |
97 tri_list = tsearch (x, y, tri, xi(:), yi(:)); | |
6823 | 98 |
8507 | 99 ## Only keep the points within triangles. |
20038
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
100 valid = ! isnan (tri_list); |
9496 | 101 tri_list = tri_list(valid); |
6826 | 102 nr_t = rows (tri_list); |
6823 | 103 |
9496 | 104 tri = tri(tri_list,:); |
105 | |
8507 | 106 ## Assign x,y,z for each point of triangle. |
9496 | 107 x1 = x(tri(:,1)); |
108 x2 = x(tri(:,2)); | |
109 x3 = x(tri(:,3)); | |
6826 | 110 |
9496 | 111 y1 = y(tri(:,1)); |
112 y2 = y(tri(:,2)); | |
113 y3 = y(tri(:,3)); | |
6826 | 114 |
9496 | 115 z1 = z(tri(:,1)); |
116 z2 = z(tri(:,2)); | |
117 z3 = z(tri(:,3)); | |
6823 | 118 |
8507 | 119 ## Calculate norm vector. |
6826 | 120 N = cross ([x2-x1, y2-y1, z2-z1], [x3-x1, y3-y1, z3-z1]); |
9496 | 121 ## Normalize. |
122 N = diag (norm (N, "rows")) \ N; | |
10945
aa40bdbfa478
griddata.m: Allow x, y inputs to be vectors, and z a matrix.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
123 |
8507 | 124 ## Calculate D of plane equation |
125 ## Ax+By+Cz+D = 0; | |
6823 | 126 D = -(N(:,1) .* x1 + N(:,2) .* y1 + N(:,3) .* z1); |
10945
aa40bdbfa478
griddata.m: Allow x, y inputs to be vectors, and z a matrix.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
127 |
8507 | 128 ## Calculate zi by solving plane equation for xi, yi. |
9677
8cf522ce9c4d
fix griddata with vectors
Jaroslav Hajek <highegg@gmail.com>
parents:
9501
diff
changeset
|
129 zi(valid) = -(N(:,1).*xi(:)(valid) + N(:,2).*yi(:)(valid) + D) ./ N(:,3); |
10945
aa40bdbfa478
griddata.m: Allow x, y inputs to be vectors, and z a matrix.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
130 |
6823 | 131 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:
10945
diff
changeset
|
132 error ("griddata: unknown interpolation METHOD"); |
6823 | 133 endif |
134 | |
6826 | 135 if (nargout == 3) |
6823 | 136 rx = xi; |
137 ry = yi; | |
138 rz = zi; | |
6826 | 139 elseif (nargout == 1) |
6823 | 140 rx = zi; |
6826 | 141 elseif (nargout == 0) |
142 mesh (xi, yi, zi); | |
6823 | 143 endif |
14368
5736d93b22d0
griddata.m: Accept vectors in any orientation (Bug #33539)
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
144 |
6823 | 145 endfunction |
146 | |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
147 |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
148 %!demo |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
149 %! 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
|
150 %! 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
|
151 %! x = 2*rand (100,1) - 1; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
152 %! y = 2*rand (size (x)) - 1; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
153 %! z = sin (2*(x.^2 + y.^2)); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
154 %! [xx,yy] = meshgrid (linspace (-1,1,32)); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
155 %! griddata (x,y,z,xx,yy); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
156 %! title ("nonuniform grid sampled at 100 points"); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
157 |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
158 %!demo |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
159 %! 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
|
160 %! 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
|
161 %! x = 2*rand (1000,1) - 1; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
162 %! y = 2*rand (size (x)) - 1; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
163 %! z = sin (2*(x.^2 + y.^2)); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
164 %! [xx,yy] = meshgrid (linspace (-1,1,32)); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
165 %! griddata (x,y,z,xx,yy); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
166 %! title ("nonuniform grid sampled at 1000 points"); |
6823 | 167 |
168 %!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
|
169 %! 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
|
170 %! 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
|
171 %! x = 2*rand (1000,1) - 1; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
172 %! y = 2*rand (size (x)) - 1; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
173 %! z = sin (2*(x.^2 + y.^2)); |
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
|
174 %! [xx,yy] = meshgrid (linspace (-1,1,32)); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
175 %! griddata (x,y,z,xx,yy,"nearest"); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
176 %! title ("nonuniform grid sampled at 1000 points with nearest neighbor"); |
6823 | 177 |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
178 %!testif HAVE_QHULL |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
179 %! [xx,yy] = meshgrid (linspace (-1,1,32)); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
180 %! x = xx(:); |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14372
diff
changeset
|
181 %! x = x + 10*(2*round (rand (size (x))) - 1) * eps; |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
182 %! y = yy(:); |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14372
diff
changeset
|
183 %! y = y + 10*(2*round (rand (size (y))) - 1) * eps; |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
184 %! z = sin (2*(x.^2 + y.^2)); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
185 %! zz = griddata (x,y,z,xx,yy,"linear"); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
186 %! zz2 = sin (2*(xx.^2 + yy.^2)); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
187 %! zz2(isnan (zz)) = NaN; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
188 %! assert (zz, zz2, 100*eps); |
6823 | 189 |
20038
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
190 ## Test input validation |
14368
5736d93b22d0
griddata.m: Accept vectors in any orientation (Bug #33539)
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
191 %!error griddata () |
5736d93b22d0
griddata.m: Accept vectors in any orientation (Bug #33539)
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
192 %!error griddata (1) |
5736d93b22d0
griddata.m: Accept vectors in any orientation (Bug #33539)
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
193 %!error griddata (1,2) |
5736d93b22d0
griddata.m: Accept vectors in any orientation (Bug #33539)
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
194 %!error griddata (1,2,3) |
5736d93b22d0
griddata.m: Accept vectors in any orientation (Bug #33539)
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
195 %!error griddata (1,2,3,4) |
5736d93b22d0
griddata.m: Accept vectors in any orientation (Bug #33539)
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
196 %!error griddata (1,2,3,4,5,6,7) |
5736d93b22d0
griddata.m: Accept vectors in any orientation (Bug #33539)
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
197 %!error <vectors of the same length> griddata (1:3, 1:3, 1:4, 1:3, 1:3) |
5736d93b22d0
griddata.m: Accept vectors in any orientation (Bug #33539)
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
198 %!error <vectors of the same length> griddata (1:3, 1:4, 1:3, 1:3, 1:3) |
5736d93b22d0
griddata.m: Accept vectors in any orientation (Bug #33539)
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
199 %!error <vectors of the same length> griddata (1:4, 1:3, 1:3, 1:3, 1:3) |
5736d93b22d0
griddata.m: Accept vectors in any orientation (Bug #33539)
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
200 %!error <the columns and rows of Z> griddata (1:4, 1:3, ones (4,4), 1:3, 1:3) |
5736d93b22d0
griddata.m: Accept vectors in any orientation (Bug #33539)
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
201 %!error <the columns and rows of Z> griddata (1:4, 1:3, ones (3,5), 1:3, 1:3) |
5736d93b22d0
griddata.m: Accept vectors in any orientation (Bug #33539)
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
202 %!error <matrices of same size> griddata (1:3, 1:3, 1:3, 1:4, 1:3) |
5736d93b22d0
griddata.m: Accept vectors in any orientation (Bug #33539)
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
203 %!error <matrices of same size> griddata (1:3, 1:3, 1:3, 1:3, 1:4) |
5736d93b22d0
griddata.m: Accept vectors in any orientation (Bug #33539)
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
204 |