1 ## Copyright (C) 2007-2012 David Bateman
3 ## This file is part of Octave.
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
7 ## the Free Software Foundation; either version 3 of the License, or (at
8 ## your option) any later version.
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.
15 ## You should have received a copy of the GNU General Public License
16 ## along with Octave; see the file COPYING. If not, see
17 ## <http://www.gnu.org/licenses/>.
20 ## @deftypefn {Function File} {} quiver3 (@var{u}, @var{v}, @var{w})
21 ## @deftypefnx {Function File} {} quiver3 (@var{x}, @var{y}, @var{z}, @var{u}, @var{v}, @var{w})
22 ## @deftypefnx {Function File} {} quiver3 (@dots{}, @var{s})
23 ## @deftypefnx {Function File} {} quiver3 (@dots{}, @var{style})
24 ## @deftypefnx {Function File} {} quiver3 (@dots{}, 'filled')
25 ## @deftypefnx {Function File} {} quiver3 (@var{h}, @dots{})
26 ## @deftypefnx {Function File} {@var{h} =} quiver3 (@dots{})
28 ## Plot the @code{(@var{u}, @var{v}, @var{w})} components of a vector field in
29 ## an @code{(@var{x}, @var{y}), @var{z}} meshgrid. If the grid is uniform, you
30 ## can specify @var{x}, @var{y} @var{z} as vectors.
32 ## If @var{x}, @var{y} and @var{z} are undefined they are assumed to be
33 ## @code{(1:@var{m}, 1:@var{n}, 1:@var{p})} where @code{[@var{m}, @var{n}] =
34 ## size(@var{u})} and @code{@var{p} = max (size (@var{w}))}.
36 ## The variable @var{s} is a scalar defining a scaling factor to use for
37 ## the arrows of the field relative to the mesh spacing. A value of 0
38 ## disables all scaling. The default value is 1.
40 ## The style to use for the plot can be defined with a line style @var{style}
41 ## in a similar manner to the line styles used with the @code{plot} command.
42 ## If a marker is specified then markers at the grid points of the vectors are
43 ## printed rather than arrows. If the argument 'filled' is given then the
46 ## The optional return value @var{h} is a graphics handle to a quiver object.
47 ## A quiver object regroups the components of the quiver plot (body, arrow,
48 ## and marker), and allows them to be changed together.
52 ## [x, y, z] = peaks (25);
55 ## [u, v, w] = surfnorm (x, y, z / 10);
56 ## h = quiver3 (x, y, z, u, v, w);
57 ## set (h, "maxheadsize", 0.33);
64 function retval = quiver3 (varargin)
66 [h, varargin, nargin] = __plt_get_axis_arg__ ("quiver3", varargin{:});
75 tmp = __quiver__ (h, 1, varargin{:});
76 unwind_protect_cleanup
89 %! colormap (jet (64));
90 %! [x,y] = meshgrid (-1:0.1:1);
91 %! z = sin (2*pi * sqrt (x.^2+y.^2));
92 %! theta = 2*pi * sqrt (x.^2+y.^2) + pi/2;
93 %! quiver3 (x, y, z, sin (theta), cos (theta), ones (size (z)));
100 %! [x, y, z] = peaks (25);
103 %! [u, v, w] = surfnorm (x, y, z / 10);
104 %! h = quiver3 (x, y, z, u, v, w);
105 %! set (h, "maxheadsize", 0.33);
110 %! [x, y, z] = peaks (25);
113 %! [u, v, w] = surfnorm (x, y, z / 10);
114 %! h = quiver3 (x, y, z, u, v, w);
115 %! set (h, "maxheadsize", 0.33);