annotate scripts/plot/draw/ezmesh.m @ 27919:1891570abac8

update Octave Project Developers copyright for the new year In files that have the "Octave Project Developers" copyright notice, update for 2020.
author John W. Eaton <jwe@octave.org>
date Mon, 06 Jan 2020 22:29:51 -0500
parents b442ec6dda5c
children bd51beb6205e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27919
1891570abac8 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 27918
diff changeset
1 ## Copyright (C) 2007-2020 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
2 ##
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
3 ## See the file COPYRIGHT.md in the top-level directory of this distribution
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
4 ## or <https://octave.org/COPYRIGHT.html/>.
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
5 ##
7337
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
6 ##
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
7 ## This file is part of Octave.
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
8 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24455
diff changeset
9 ## Octave is free software: you can redistribute it and/or modify it
7337
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
10 ## under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24455
diff changeset
11 ## the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
12 ## (at your option) any later version.
7337
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
13 ##
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
14 ## Octave is distributed in the hope that it will be useful, but
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
15 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
16 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
17 ## GNU General Public License for more details.
7337
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
18 ##
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
19 ## You should have received a copy of the GNU General Public License
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
20 ## along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24455
diff changeset
21 ## <https://www.gnu.org/licenses/>.
7337
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
22
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
23 ## -*- texinfo -*-
20852
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19697
diff changeset
24 ## @deftypefn {} {} ezmesh (@var{f})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19697
diff changeset
25 ## @deftypefnx {} {} ezmesh (@var{fx}, @var{fy}, @var{fz})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19697
diff changeset
26 ## @deftypefnx {} {} ezmesh (@dots{}, @var{dom})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19697
diff changeset
27 ## @deftypefnx {} {} ezmesh (@dots{}, @var{n})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19697
diff changeset
28 ## @deftypefnx {} {} ezmesh (@dots{}, "circ")
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19697
diff changeset
29 ## @deftypefnx {} {} ezmesh (@var{hax}, @dots{})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19697
diff changeset
30 ## @deftypefnx {} {@var{h} =} ezmesh (@dots{})
7337
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
31 ##
16993
78f57b14535c Overhaul ez* family of plot functions.
Rik <rik@octave.org>
parents: 14868
diff changeset
32 ## Plot the mesh defined by a function.
7337
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
33 ##
16993
78f57b14535c Overhaul ez* family of plot functions.
Rik <rik@octave.org>
parents: 14868
diff changeset
34 ## @var{f} is a string, inline function, or function handle with two arguments
78f57b14535c Overhaul ez* family of plot functions.
Rik <rik@octave.org>
parents: 14868
diff changeset
35 ## defining the function. By default the plot is over the meshed domain
78f57b14535c Overhaul ez* family of plot functions.
Rik <rik@octave.org>
parents: 14868
diff changeset
36 ## @code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
7337
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
37 ##
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
38 ## If three functions are passed, then plot the parametrically defined
24454
b9d482dd90f3 doc: Fix mistaken use of space between function and '(' in documentation (bug #52723).
Rik <rik@octave.org>
parents: 24431
diff changeset
39 ## function @code{[@var{fx}(@var{s}, @var{t}), @var{fy}(@var{s}, @var{t}),
b9d482dd90f3 doc: Fix mistaken use of space between function and '(' in documentation (bug #52723).
Rik <rik@octave.org>
parents: 24431
diff changeset
40 ## @var{fz}(@var{s}, @var{t})]}.
7337
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
41 ##
16993
78f57b14535c Overhaul ez* family of plot functions.
Rik <rik@octave.org>
parents: 14868
diff changeset
42 ## If @var{dom} is a two element vector, it represents the minimum and maximum
78f57b14535c Overhaul ez* family of plot functions.
Rik <rik@octave.org>
parents: 14868
diff changeset
43 ## values of both @var{x} and @var{y}. If @var{dom} is a four element vector,
78f57b14535c Overhaul ez* family of plot functions.
Rik <rik@octave.org>
parents: 14868
diff changeset
44 ## then the minimum and maximum values are @code{[xmin xmax ymin ymax]}.
78f57b14535c Overhaul ez* family of plot functions.
Rik <rik@octave.org>
parents: 14868
diff changeset
45 ##
78f57b14535c Overhaul ez* family of plot functions.
Rik <rik@octave.org>
parents: 14868
diff changeset
46 ## @var{n} is a scalar defining the number of points to use in each dimension.
78f57b14535c Overhaul ez* family of plot functions.
Rik <rik@octave.org>
parents: 14868
diff changeset
47 ##
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17122
diff changeset
48 ## If the argument @qcode{"circ"} is given, then the function is plotted over
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17122
diff changeset
49 ## a disk centered on the middle of the domain @var{dom}.
7337
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
50 ##
24431
0c6cedafc71e doc: Use 'axes' rather than 'axis' appropriately in docstrings.
Rik <rik@octave.org>
parents: 23219
diff changeset
51 ## If the first argument @var{hax} is an axes handle, then plot into this axes,
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16993
diff changeset
52 ## rather than the current axes returned by @code{gca}.
16993
78f57b14535c Overhaul ez* family of plot functions.
Rik <rik@octave.org>
parents: 14868
diff changeset
53 ##
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
54 ## The optional return value @var{h} is a graphics handle to the created
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
55 ## surface object.
7337
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
56 ##
16993
78f57b14535c Overhaul ez* family of plot functions.
Rik <rik@octave.org>
parents: 14868
diff changeset
57 ## Example 1: 2-argument function
78f57b14535c Overhaul ez* family of plot functions.
Rik <rik@octave.org>
parents: 14868
diff changeset
58 ##
7337
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
59 ## @example
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
60 ## @group
14327
4d917a6a858b doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
61 ## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
7337
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
62 ## ezmesh (f, [-3, 3]);
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
63 ## @end group
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
64 ## @end example
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
65 ##
16993
78f57b14535c Overhaul ez* family of plot functions.
Rik <rik@octave.org>
parents: 14868
diff changeset
66 ## Example 2: parametrically defined function
7337
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
67 ##
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
68 ## @example
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
69 ## @group
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14359
diff changeset
70 ## fx = @@(s,t) cos (s) .* cos (t);
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14359
diff changeset
71 ## fy = @@(s,t) sin (s) .* cos (t);
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14359
diff changeset
72 ## fz = @@(s,t) sin (t);
7337
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
73 ## ezmesh (fx, fy, fz, [-pi, pi, -pi/2, pi/2], 20);
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
74 ## @end group
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
75 ## @end example
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
76 ##
16993
78f57b14535c Overhaul ez* family of plot functions.
Rik <rik@octave.org>
parents: 14868
diff changeset
77 ## @seealso{mesh, ezmeshc, ezplot, ezsurf, ezsurfc, hidden}
7337
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
78 ## @end deftypefn
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
79
16993
78f57b14535c Overhaul ez* family of plot functions.
Rik <rik@octave.org>
parents: 14868
diff changeset
80 function h = ezmesh (varargin)
7337
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
81
16993
78f57b14535c Overhaul ez* family of plot functions.
Rik <rik@octave.org>
parents: 14868
diff changeset
82 [htmp, needusage] = __ezplot__ ("mesh", varargin{:});
7337
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
83
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
84 if (needusage)
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
85 print_usage ();
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
86 endif
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
87
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
88 if (nargout > 0)
16993
78f57b14535c Overhaul ez* family of plot functions.
Rik <rik@octave.org>
parents: 14868
diff changeset
89 h = htmp;
7337
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
90 endif
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
91
7337
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
92 endfunction
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
93
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
94
7337
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
95 %!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
96 %! clf;
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 20852
diff changeset
97 %! 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
98 %! f = @(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
7337
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
99 %! ezmesh (f, [-3, 3]);
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
100
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
101 %!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
102 %! clf;
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 20852
diff changeset
103 %! colormap ("default");
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14359
diff changeset
104 %! fx = @(s,t) cos (s) .* cos (t);
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14359
diff changeset
105 %! fy = @(s,t) sin (s) .* cos (t);
7337
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
106 %! fz = @(s,t) sin (t);
e70789e0cd92 [project @ 2007-12-28 21:04:44 by jwe]
jwe
parents:
diff changeset
107 %! ezmesh (fx, fy, fz, [-pi,pi,-pi/2,pi/2], 20);