annotate scripts/plot/contourc.m @ 17191:85e55da61409

doc: Clarify description of plot format. * scripts/plot/plot.m: Clarify description of plot format.
author Rik <rik@octave.org>
date Tue, 06 Aug 2013 21:23:38 -0700
parents eaab03308c0b
children 56e72e8d1aba
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 11587
diff changeset
1 ## Copyright (C) 2003-2012 Shai Ayal
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
2 ##
6440
98ee80702bca [project @ 2007-03-23 15:13:19 by jwe]
jwe
parents: 6269
diff changeset
3 ## This file is part of Octave.
98ee80702bca [project @ 2007-03-23 15:13:19 by jwe]
jwe
parents: 6269
diff changeset
4 ##
98ee80702bca [project @ 2007-03-23 15:13:19 by jwe]
jwe
parents: 6269
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
8 ## your option) any later version.
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
9 ##
6440
98ee80702bca [project @ 2007-03-23 15:13:19 by jwe]
jwe
parents: 6269
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
14 ##
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
17 ## <http://www.gnu.org/licenses/>.
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
18
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
19 ## -*- texinfo -*-
16814
64e7bb01fce2 doc: Improve documentation for 2-D plot functions
Rik <rik@octave.org>
parents: 14872
diff changeset
20 ## @deftypefn {Function File} {[@var{c}, @var{lev}] =} contourc (@var{z})
64e7bb01fce2 doc: Improve documentation for 2-D plot functions
Rik <rik@octave.org>
parents: 14872
diff changeset
21 ## @deftypefnx {Function File} {[@var{c}, @var{lev}] =} contourc (@var{z}, @var{vn})
64e7bb01fce2 doc: Improve documentation for 2-D plot functions
Rik <rik@octave.org>
parents: 14872
diff changeset
22 ## @deftypefnx {Function File} {[@var{c}, @var{lev}] =} contourc (@var{x}, @var{y}, @var{z})
64e7bb01fce2 doc: Improve documentation for 2-D plot functions
Rik <rik@octave.org>
parents: 14872
diff changeset
23 ## @deftypefnx {Function File} {[@var{c}, @var{lev}] =} contourc (@var{x}, @var{y}, @var{z}, @var{vn})
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
24 ## Compute contour lines (isolines of constant Z value).
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
25 ##
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
26 ## The matrix @var{z} contains height values above the rectangular grid
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
27 ## determined by @var{x} and @var{y}. If only a single input @var{z} is
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
28 ## provided then @var{x} is taken to be @code{1:rows (@var{z})} and @var{y} is
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
29 ## taken to be @code{1:columns (@var{z})}.
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
30 ##
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
31 ## The optional input @var{vn} is either a scalar denoting the number of
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
32 ## contour lines to compute or a vector containing the Z values where lines
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
33 ## will be computed. When @var{vn} is a vector the number of contour lines
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
34 ## is @code{numel (@var{vn})}. However, to compute a single contour line
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
35 ## at a given value use @code{@var{vn} = [val, val]}. If @var{vn} is omitted
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
36 ## it defaults to 10.
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
37 ##
16814
64e7bb01fce2 doc: Improve documentation for 2-D plot functions
Rik <rik@octave.org>
parents: 14872
diff changeset
38 ## The return value @var{c} is a 2x@var{n} matrix containing the
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
39 ## contour lines in the following format
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
40 ##
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
41 ## @example
9051
1bf0ce0930be Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents: 9040
diff changeset
42 ## @group
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
43 ## @var{c} = [lev1, x1, x2, @dots{}, levn, x1, x2, ...
9040
dbd0c77e575e Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
44 ## len1, y1, y2, @dots{}, lenn, y1, y2, @dots{}]
9051
1bf0ce0930be Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents: 9040
diff changeset
45 ## @end group
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
46 ## @end example
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
47 ##
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
48 ## @noindent
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
49 ## in which contour line @var{n} has a level (height) of @var{levn} and
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
50 ## length of @var{lenn}.
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
51 ##
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
52 ## The optional return value @var{lev} is a vector with the Z values of
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
53 ## of the contour levels.
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
54 ##
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
55 ## Example:
10846
a4f482e66b65 Grammarcheck more of the documentation.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
56 ##
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
57 ## @example
6592
8899e24ae362 [project @ 2007-04-27 04:11:48 by jwe]
jwe
parents: 6590
diff changeset
58 ## @group
8899e24ae362 [project @ 2007-04-27 04:11:48 by jwe]
jwe
parents: 6590
diff changeset
59 ## x = 0:2;
8899e24ae362 [project @ 2007-04-27 04:11:48 by jwe]
jwe
parents: 6590
diff changeset
60 ## y = x;
8899e24ae362 [project @ 2007-04-27 04:11:48 by jwe]
jwe
parents: 6590
diff changeset
61 ## z = x' * y;
8899e24ae362 [project @ 2007-04-27 04:11:48 by jwe]
jwe
parents: 6590
diff changeset
62 ## contourc (x, y, z, 2:3)
14327
4d917a6a858b doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
63 ## @result{} 2.0000 2.0000 1.0000 3.0000 1.5000 2.0000
4d917a6a858b doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
64 ## 2.0000 1.0000 2.0000 2.0000 2.0000 1.5000
6592
8899e24ae362 [project @ 2007-04-27 04:11:48 by jwe]
jwe
parents: 6590
diff changeset
65 ## @end group
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
66 ## @end example
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16814
diff changeset
67 ## @seealso{contour, contourf, contour3, clabel}
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
68 ## @end deftypefn
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
69
7327
9af6f0a214ee [project @ 2007-12-19 21:39:02 by jwe]
jwe
parents: 7245
diff changeset
70 ## Author: Shai Ayal <shaiay@users.sourceforge.net>
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
71
8236
7799d8c38312 Small plotting fixes
David Bateman <dbateman@free.fr>
parents: 7327
diff changeset
72 function [cout, lev] = contourc (varargin)
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
73
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
74 if (nargin == 1)
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
75 vn = 10;
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
76 z = varargin{1};
11499
8f23b6757225 Correction to contourc.m
Michael Godfrey <godfrey@isl.stanford.edu>
parents: 11472
diff changeset
77 [nr, nc] = size (z);
8f23b6757225 Correction to contourc.m
Michael Godfrey <godfrey@isl.stanford.edu>
parents: 11472
diff changeset
78 x = 1:nc;
8f23b6757225 Correction to contourc.m
Michael Godfrey <godfrey@isl.stanford.edu>
parents: 11472
diff changeset
79 y = 1:nr;
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
80 elseif (nargin == 2)
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
81 vn = varargin{2};
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
82 z = varargin{1};
7327
9af6f0a214ee [project @ 2007-12-19 21:39:02 by jwe]
jwe
parents: 7245
diff changeset
83 [nr, nc] = size (z);
9af6f0a214ee [project @ 2007-12-19 21:39:02 by jwe]
jwe
parents: 7245
diff changeset
84 x = 1:nc;
9af6f0a214ee [project @ 2007-12-19 21:39:02 by jwe]
jwe
parents: 7245
diff changeset
85 y = 1:nr;
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
86 elseif (nargin == 3)
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
87 vn = 10;
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
88 x = varargin{1};
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
89 y = varargin{2};
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
90 z = varargin{3};
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
91 elseif (nargin == 4)
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
92 vn = varargin{4};
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
93 x = varargin{1};
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
94 y = varargin{2};
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
95 z = varargin{3};
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
96 else
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
97 print_usage ();
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
98 endif
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
99
10634
60542efcfa2c Check input arguments for size and type (bug #29861).
Rik <octave@nomad.inbox5.com>
parents: 9758
diff changeset
100 if (!ismatrix (z) || isvector (z) || isscalar (z))
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
101 error ("contourc: Z argument must be a matrix");
10634
60542efcfa2c Check input arguments for size and type (bug #29861).
Rik <octave@nomad.inbox5.com>
parents: 9758
diff changeset
102 endif
60542efcfa2c Check input arguments for size and type (bug #29861).
Rik <octave@nomad.inbox5.com>
parents: 9758
diff changeset
103
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
104 if (isscalar (vn))
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
105 vv = linspace (min (z(:)), max (z(:)), vn+2)(2:end-1);
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
106 else
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
107 vv = unique (sort (vn));
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
108 endif
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
109
7327
9af6f0a214ee [project @ 2007-12-19 21:39:02 by jwe]
jwe
parents: 7245
diff changeset
110 if (isvector (x) && isvector (y))
9af6f0a214ee [project @ 2007-12-19 21:39:02 by jwe]
jwe
parents: 7245
diff changeset
111 c = __contourc__ (x(:)', y(:)', z, vv);
9af6f0a214ee [project @ 2007-12-19 21:39:02 by jwe]
jwe
parents: 7245
diff changeset
112 else
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
113 ## Indexes x,y for the purpose of __contourc__.
14872
c2dbdeaa25df maint: use rows() and columns() to clarify m-files.
Rik <octave@nomad.inbox5.com>
parents: 14363
diff changeset
114 ii = 1:columns (z);
c2dbdeaa25df maint: use rows() and columns() to clarify m-files.
Rik <octave@nomad.inbox5.com>
parents: 14363
diff changeset
115 jj = 1:rows (z);
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
116
7327
9af6f0a214ee [project @ 2007-12-19 21:39:02 by jwe]
jwe
parents: 7245
diff changeset
117 ## Now call __contourc__ for the real work...
9af6f0a214ee [project @ 2007-12-19 21:39:02 by jwe]
jwe
parents: 7245
diff changeset
118 c = __contourc__ (ii, jj, z, vv);
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
119
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
120 ## Map the contour lines from index space (i,j) back
7327
9af6f0a214ee [project @ 2007-12-19 21:39:02 by jwe]
jwe
parents: 7245
diff changeset
121 ## to the original grid (x,y)
9af6f0a214ee [project @ 2007-12-19 21:39:02 by jwe]
jwe
parents: 7245
diff changeset
122 i = 1;
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
123
14872
c2dbdeaa25df maint: use rows() and columns() to clarify m-files.
Rik <octave@nomad.inbox5.com>
parents: 14363
diff changeset
124 while (i < columns (c))
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
125 clen = c(2, i);
7327
9af6f0a214ee [project @ 2007-12-19 21:39:02 by jwe]
jwe
parents: 7245
diff changeset
126 ind = i + [1 : clen];
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
127
7327
9af6f0a214ee [project @ 2007-12-19 21:39:02 by jwe]
jwe
parents: 7245
diff changeset
128 ci = c(1, ind);
9af6f0a214ee [project @ 2007-12-19 21:39:02 by jwe]
jwe
parents: 7245
diff changeset
129 cj = c(2,ind);
9af6f0a214ee [project @ 2007-12-19 21:39:02 by jwe]
jwe
parents: 7245
diff changeset
130
9af6f0a214ee [project @ 2007-12-19 21:39:02 by jwe]
jwe
parents: 7245
diff changeset
131 ## due to rounding errors some elements of ci and cj
9af6f0a214ee [project @ 2007-12-19 21:39:02 by jwe]
jwe
parents: 7245
diff changeset
132 ## can fall out of the range of ii and jj and interp2 would
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
133 ## return NA for those values.
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
134 ## The permitted range is enforced here:
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
135
14872
c2dbdeaa25df maint: use rows() and columns() to clarify m-files.
Rik <octave@nomad.inbox5.com>
parents: 14363
diff changeset
136 ci = max (ci, 1); ci = min (ci, columns (z));
c2dbdeaa25df maint: use rows() and columns() to clarify m-files.
Rik <octave@nomad.inbox5.com>
parents: 14363
diff changeset
137 cj = max (cj, 1); cj = min (cj, rows (z));
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
138
7327
9af6f0a214ee [project @ 2007-12-19 21:39:02 by jwe]
jwe
parents: 7245
diff changeset
139 c(1, ind) = interp2 (ii, jj, x, ci, cj);
9af6f0a214ee [project @ 2007-12-19 21:39:02 by jwe]
jwe
parents: 7245
diff changeset
140 c(2, ind) = interp2 (ii, jj, y, ci, cj);
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
141
7327
9af6f0a214ee [project @ 2007-12-19 21:39:02 by jwe]
jwe
parents: 7245
diff changeset
142 i = i + clen + 1;
9af6f0a214ee [project @ 2007-12-19 21:39:02 by jwe]
jwe
parents: 7245
diff changeset
143 endwhile
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
144 endif
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
145
8236
7799d8c38312 Small plotting fixes
David Bateman <dbateman@free.fr>
parents: 7327
diff changeset
146 if (nargout > 0)
7799d8c38312 Small plotting fixes
David Bateman <dbateman@free.fr>
parents: 7327
diff changeset
147 cout = c;
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
148 lev = vv;
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
149 endif
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
150
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
151 endfunction
7245
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7017
diff changeset
152
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14327
diff changeset
153
8790
a013ff655ca4 Trivial changes to demos to produce a more pleasant output for octave+gnuplot+aquaterm.
Ben Abbott <bpabbott@mac.com>
parents: 8325
diff changeset
154 %!test
7245
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7017
diff changeset
155 %! x = 0:2;
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7017
diff changeset
156 %! y = x;
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7017
diff changeset
157 %! z = x' * y;
8790
a013ff655ca4 Trivial changes to demos to produce a more pleasant output for octave+gnuplot+aquaterm.
Ben Abbott <bpabbott@mac.com>
parents: 8325
diff changeset
158 %! [c_actual, lev_actual]= contourc (x, y, z, 2:3);
a013ff655ca4 Trivial changes to demos to produce a more pleasant output for octave+gnuplot+aquaterm.
Ben Abbott <bpabbott@mac.com>
parents: 8325
diff changeset
159 %! c_expected = [2, 1, 1, 2, 2, 3, 1.5, 2; 4, 2, 2, 1, 1, 2, 2, 1.5];
a013ff655ca4 Trivial changes to demos to produce a more pleasant output for octave+gnuplot+aquaterm.
Ben Abbott <bpabbott@mac.com>
parents: 8325
diff changeset
160 %! lev_expected = [2 3];
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14327
diff changeset
161 %! assert (c_actual, c_expected, eps);
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14327
diff changeset
162 %! assert (lev_actual, lev_expected, eps);
8790
a013ff655ca4 Trivial changes to demos to produce a more pleasant output for octave+gnuplot+aquaterm.
Ben Abbott <bpabbott@mac.com>
parents: 8325
diff changeset
163