Mercurial > octave
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 |
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 | 6 ## |
7 ## This file is part of Octave. | |
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 | 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 | 13 ## |
14 ## Octave is distributed in the hope that it will be useful, but | |
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 | 18 ## |
19 ## You should have received a copy of the GNU General Public License | |
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 | 22 |
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 | 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 | 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 | 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 | 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 | 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 | 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 | 59 ## @example |
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 | 62 ## ezmesh (f, [-3, 3]); |
63 ## @end group | |
64 ## @end example | |
65 ## | |
16993
78f57b14535c
Overhaul ez* family of plot functions.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
66 ## Example 2: parametrically defined function |
7337 | 67 ## |
68 ## @example | |
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 | 73 ## ezmesh (fx, fy, fz, [-pi, pi, -pi/2, pi/2], 20); |
74 ## @end group | |
75 ## @end example | |
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 | 78 ## @end deftypefn |
79 | |
16993
78f57b14535c
Overhaul ez* family of plot functions.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
80 function h = ezmesh (varargin) |
7337 | 81 |
16993
78f57b14535c
Overhaul ez* family of plot functions.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
82 [htmp, needusage] = __ezplot__ ("mesh", varargin{:}); |
7337 | 83 |
84 if (needusage) | |
85 print_usage (); | |
86 endif | |
87 | |
88 if (nargout > 0) | |
16993
78f57b14535c
Overhaul ez* family of plot functions.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
89 h = htmp; |
7337 | 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 | 92 endfunction |
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 | 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 | 99 %! ezmesh (f, [-3, 3]); |
100 | |
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 | 106 %! fz = @(s,t) sin (t); |
107 %! ezmesh (fx, fy, fz, [-pi,pi,-pi/2,pi/2], 20); |