Mercurial > octave
annotate scripts/general/cart2pol.m @ 31203:4c2b83516eb7
isequal.m: Run BISTs for Java objects only conditionally (bug #62930).
* scripts/general/isequal.m: Run BISTs for Java objects only if Octave was
configured with Java support and a Java VM is available at runtime.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Fri, 26 Aug 2022 22:30:43 +0200 |
parents | 796f54d4ddbf |
children | 597f3ee61a48 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 ######################################################################## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 ## |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
3 ## Copyright (C) 2000-2022 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27898
diff
changeset
|
4 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 ## See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 ## distribution or <https://octave.org/copyright/>. |
3803 | 7 ## |
8 ## This file is part of Octave. | |
9 ## | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
3803 | 11 ## 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:
23220
diff
changeset
|
12 ## the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22432
diff
changeset
|
13 ## (at your option) any later version. |
3803 | 14 ## |
15 ## Octave is distributed in the hope that it will be useful, but | |
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22432
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22432
diff
changeset
|
18 ## GNU General Public License for more details. |
3803 | 19 ## |
20 ## You should have received a copy of the GNU General Public License | |
7016 | 21 ## 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:
23220
diff
changeset
|
22 ## <https://www.gnu.org/licenses/>. |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 ## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 ######################################################################## |
3803 | 25 |
26 ## -*- texinfo -*- | |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20158
diff
changeset
|
27 ## @deftypefn {} {[@var{theta}, @var{r}] =} cart2pol (@var{x}, @var{y}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20158
diff
changeset
|
28 ## @deftypefnx {} {[@var{theta}, @var{r}, @var{z}] =} cart2pol (@var{x}, @var{y}, @var{z}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20158
diff
changeset
|
29 ## @deftypefnx {} {[@var{theta}, @var{r}] =} cart2pol (@var{C}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20158
diff
changeset
|
30 ## @deftypefnx {} {[@var{theta}, @var{r}, @var{z}] =} cart2pol (@var{C}) |
10688
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
10687
diff
changeset
|
31 ## |
20158
7503499a252b
doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
32 ## Transform Cartesian coordinates to polar or cylindrical coordinates. |
7503499a252b
doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
33 ## |
7503499a252b
doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
34 ## The inputs @var{x}, @var{y} (, and @var{z}) must be the same shape, or |
7503499a252b
doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
35 ## scalar. If called with a single matrix argument then each row of @var{C} |
28171
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
36 ## represents the Cartesian coordinate pair (@var{x}, @var{y}) or triplet |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
37 ## (@var{x}, @var{y}, @var{z}). |
10688
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
10687
diff
changeset
|
38 ## |
28171
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
39 ## The outputs @var{theta}, @var{r} (, and @var{z}) match the shape of the |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
40 ## inputs. For a matrix input @var{C} the outputs will be column vectors with |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
41 ## rows corresponding to the rows of the input matrix. |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
42 ## |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
43 ## @var{theta} describes the angle relative to the positive x-axis measured in |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
44 ## the xy-plane. |
20158
7503499a252b
doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
45 ## |
10687
a8ce6bdecce5
Improve documentation strings.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
46 ## @var{r} is the distance to the z-axis @w{(0, 0, z)}. |
10688
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
10687
diff
changeset
|
47 ## |
28171
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
48 ## @var{z}, if present, is unchanged by the transformation. |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
49 ## |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
50 ## The coordinate transformation is computed using: |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
51 ## |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
52 ## @tex |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
53 ## $$ \theta = \arctan \left ( {y \over x} \right ) $$ |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
54 ## $$ r = \sqrt{x^2 + y^2} $$ |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
55 ## $$ z = z $$ |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
56 ## @end tex |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
57 ## @ifnottex |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
58 ## |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
59 ## @example |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
60 ## @group |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
61 ## @var{theta} = arctan (@var{y} / @var{x}) |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
62 ## @var{r} = sqrt (@var{x}^2 + @var{y}^2) |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
63 ## @var{z} = @var{z} |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
64 ## @end group |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
65 ## @end example |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
66 ## |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
67 ## @end ifnottex |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
68 ## |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
69 ## @c FIXME: Remove this note in Octave 9.1 (two releases after 7.1). |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
70 ## Note: For @sc{matlab} compatibility, this function no longer returns a full |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
71 ## coordinate matrix when called with a single return argument. |
5642 | 72 ## @seealso{pol2cart, cart2sph, sph2cart} |
3803 | 73 ## @end deftypefn |
74 | |
17585
36b9fa789d8e
Overhaul polar, spherical, cartesian conversion routiens when nargout == 1.
Rik <rik@octave.org>
parents:
14363
diff
changeset
|
75 function [theta, r, z] = cart2pol (x, y, z = []) |
3803 | 76 |
28789
28de41192f3c
Eliminate unneeded verification of nargin, nargout in m-files.
Rik <rik@octave.org>
parents:
28171
diff
changeset
|
77 if (nargin < 1) |
10688
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
10687
diff
changeset
|
78 print_usage (); |
3803 | 79 endif |
80 | |
10688
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
10687
diff
changeset
|
81 if (nargin == 1) |
28171
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
82 if (! (isnumeric (x) && ismatrix (x))) |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
83 error ("cart2pol: matrix input must be 2-D numeric array"); |
10688
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
10687
diff
changeset
|
84 endif |
28171
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
85 if (isvector (x)) |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
86 n = numel (x); |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
87 if (n != 2 && n != 3) |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
88 error ("cart2pol: matrix input must be a 2- or 3-element vector or a 2- or 3-column array"); |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
89 endif |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
90 if (n == 3) |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
91 z = x(3); |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
92 endif |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
93 y = x(2); |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
94 x = x(1); |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
95 else |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
96 ncols = columns (x); |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
97 if (ncols != 2 && ncols != 3) |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
98 error ("cart2pol: matrix input must be a 2- or 3-element vector or a 2- or 3-column array"); |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
99 endif |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
100 |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
101 if (ncols == 3) |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
102 z = x(:,3); |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
103 endif |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
104 y = x(:,2); |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
105 x = x(:,1); |
21172
5f62b5dae8b1
Fix regression for coordinate transforms on 3-D arrays (partial fix bug #47036).
Colin Macdonald <cbm@m.fsf.org>
parents:
20158
diff
changeset
|
106 endif |
28171
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
107 |
10688
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
10687
diff
changeset
|
108 elseif (nargin == 2) |
28171
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
109 if (! (isnumeric (x) && isnumeric (y))) |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
110 error ("cart2pol: X, Y must be numeric arrays or scalars"); |
22432
1e88747417e6
Allow mixed scalar/array inputs to cart2pol, cart2sph, pol2cart, sph2cart (bug #48950).
Rik <rik@octave.org>
parents:
21178
diff
changeset
|
111 endif |
1e88747417e6
Allow mixed scalar/array inputs to cart2pol, cart2sph, pol2cart, sph2cart (bug #48950).
Rik <rik@octave.org>
parents:
21178
diff
changeset
|
112 [err, x, y] = common_size (x, y); |
1e88747417e6
Allow mixed scalar/array inputs to cart2pol, cart2sph, pol2cart, sph2cart (bug #48950).
Rik <rik@octave.org>
parents:
21178
diff
changeset
|
113 if (err) |
28171
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
114 error ("cart2pol: X, Y must be the same size or scalars"); |
10688
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
10687
diff
changeset
|
115 endif |
28171
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
116 |
10688
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
10687
diff
changeset
|
117 elseif (nargin == 3) |
28171
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
118 if (! (isnumeric (x) && isnumeric (y) && isnumeric (z))) |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
119 error ("cart2pol: X, Y, Z must be numeric arrays or scalars"); |
22432
1e88747417e6
Allow mixed scalar/array inputs to cart2pol, cart2sph, pol2cart, sph2cart (bug #48950).
Rik <rik@octave.org>
parents:
21178
diff
changeset
|
120 endif |
1e88747417e6
Allow mixed scalar/array inputs to cart2pol, cart2sph, pol2cart, sph2cart (bug #48950).
Rik <rik@octave.org>
parents:
21178
diff
changeset
|
121 [err, x, y, z] = common_size (x, y, z); |
1e88747417e6
Allow mixed scalar/array inputs to cart2pol, cart2sph, pol2cart, sph2cart (bug #48950).
Rik <rik@octave.org>
parents:
21178
diff
changeset
|
122 if (err) |
28171
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
123 error ("cart2pol: X, Y, Z must be the same size or scalars"); |
10688
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
10687
diff
changeset
|
124 endif |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
10687
diff
changeset
|
125 endif |
8533
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
126 |
10688
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
10687
diff
changeset
|
127 theta = atan2 (y, x); |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
10687
diff
changeset
|
128 r = sqrt (x .^ 2 + y .^ 2); |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
10687
diff
changeset
|
129 |
8533
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
130 endfunction |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
131 |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
132 |
8533
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
133 %!test |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
134 %! x = [0, 1, 2]; |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
135 %! y = 0; |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
136 %! [t, r] = cart2pol (x, y); |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
137 %! assert (t, [0, 0, 0]); |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
138 %! assert (r, x); |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
139 |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
140 %!test |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
141 %! x = [0, 1, 2]; |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
142 %! y = [0, 1, 2]; |
28171
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
143 %! [t, r] = cart2pol (x, y); |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
144 %! assert (t, [0, pi/4, pi/4], eps); |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
145 %! assert (r, sqrt (2)*[0, 1, 2], eps); |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
146 |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
147 %!test |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
148 %! x = [0, 1, 2]'; |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
149 %! y = [0, 1, 2]'; |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
150 %! [t, r] = cart2pol (x, y); |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
151 %! assert (t, [0; pi/4; pi/4], eps); |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
152 %! assert (r, sqrt (2)*[0; 1; 2], eps); |
8533
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
153 |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
154 %!test |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
155 %! x = [0, 1, 2]; |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
156 %! y = [0, 1, 2]; |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
157 %! z = [0, 1, 2]; |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
158 %! [t, r, z2] = cart2pol (x, y, z); |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
159 %! assert (t, [0, pi/4, pi/4], sqrt (eps)); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
160 %! assert (r, sqrt (2)*[0, 1, 2], sqrt (eps)); |
22432
1e88747417e6
Allow mixed scalar/array inputs to cart2pol, cart2sph, pol2cart, sph2cart (bug #48950).
Rik <rik@octave.org>
parents:
21178
diff
changeset
|
161 %! assert (z2, z); |
3803 | 162 |
8533
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
163 %!test |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
164 %! x = [0, 1, 2]; |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
165 %! y = 0; |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
166 %! z = 0; |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
167 %! [t, r, z2] = cart2pol (x, y, z); |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
168 %! assert (t, [0, 0, 0], eps); |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
169 %! assert (r, x, eps); |
22432
1e88747417e6
Allow mixed scalar/array inputs to cart2pol, cart2sph, pol2cart, sph2cart (bug #48950).
Rik <rik@octave.org>
parents:
21178
diff
changeset
|
170 %! assert (z2, [0, 0, 0]); |
8533
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
171 |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
172 %!test |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
173 %! x = 0; |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
174 %! y = [0, 1, 2]; |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
175 %! z = 0; |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
176 %! [t, r, z2] = cart2pol (x, y, z); |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
177 %! assert (t, [0, 1, 1]*pi/2, eps); |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
178 %! assert (r, y, eps); |
22432
1e88747417e6
Allow mixed scalar/array inputs to cart2pol, cart2sph, pol2cart, sph2cart (bug #48950).
Rik <rik@octave.org>
parents:
21178
diff
changeset
|
179 %! assert (z2, [0, 0, 0]); |
8533
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
180 |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
181 %!test |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
182 %! x = 0; |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
183 %! y = 0; |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
184 %! z = [0, 1, 2]; |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
185 %! [t, r, z2] = cart2pol (x, y, z); |
22432
1e88747417e6
Allow mixed scalar/array inputs to cart2pol, cart2sph, pol2cart, sph2cart (bug #48950).
Rik <rik@octave.org>
parents:
21178
diff
changeset
|
186 %! assert (t, [0, 0, 0]); |
1e88747417e6
Allow mixed scalar/array inputs to cart2pol, cart2sph, pol2cart, sph2cart (bug #48950).
Rik <rik@octave.org>
parents:
21178
diff
changeset
|
187 %! assert (r, [0, 0, 0]); |
1e88747417e6
Allow mixed scalar/array inputs to cart2pol, cart2sph, pol2cart, sph2cart (bug #48950).
Rik <rik@octave.org>
parents:
21178
diff
changeset
|
188 %! assert (z2, z); |
8533
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8491
diff
changeset
|
189 |
10688
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
10687
diff
changeset
|
190 %!test |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
10687
diff
changeset
|
191 %! C = [0, 0; 1, 1; 2, 2]; |
28171
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
192 %! [t, r] = cart2pol (C); |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
193 %! assert (t, [0; 1; 1]*pi/4, eps); |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
194 %! assert (r, [0; 1; 2]*sqrt(2), eps); |
10688
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
10687
diff
changeset
|
195 |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
10687
diff
changeset
|
196 %!test |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
10687
diff
changeset
|
197 %! C = [0, 0, 0; 1, 1, 1; 2, 2, 2]; |
28171
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
198 %! [t, r, z] = cart2pol (C); |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
199 %! assert (t, [0; 1; 1]*pi/4, eps); |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
200 %! assert (r, [0; 1; 2]*sqrt(2), eps); |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
201 %! assert (z, [0; 1; 2]); |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
202 |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
203 %!test |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
204 %! C = [0, 0, 0; 1, 1, 1; 2, 2, 2;1, 1, 1]; |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
205 %! [t, r, z] = cart2pol (C); |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
206 %! assert (t, [0; 1; 1; 1]*pi/4, eps); |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
207 %! assert (r, [0; 1; 2; 1]*sqrt(2), eps); |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
208 %! assert (z, [0; 1; 2; 1]); |
10688
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
10687
diff
changeset
|
209 |
21172
5f62b5dae8b1
Fix regression for coordinate transforms on 3-D arrays (partial fix bug #47036).
Colin Macdonald <cbm@m.fsf.org>
parents:
20158
diff
changeset
|
210 %!test |
5f62b5dae8b1
Fix regression for coordinate transforms on 3-D arrays (partial fix bug #47036).
Colin Macdonald <cbm@m.fsf.org>
parents:
20158
diff
changeset
|
211 %! x = zeros (1, 1, 1, 2); |
5f62b5dae8b1
Fix regression for coordinate transforms on 3-D arrays (partial fix bug #47036).
Colin Macdonald <cbm@m.fsf.org>
parents:
20158
diff
changeset
|
212 %! x(1, 1, 1, 2) = sqrt (2); |
5f62b5dae8b1
Fix regression for coordinate transforms on 3-D arrays (partial fix bug #47036).
Colin Macdonald <cbm@m.fsf.org>
parents:
20158
diff
changeset
|
213 %! y = x; |
5f62b5dae8b1
Fix regression for coordinate transforms on 3-D arrays (partial fix bug #47036).
Colin Macdonald <cbm@m.fsf.org>
parents:
20158
diff
changeset
|
214 %! [t, r] = cart2pol (x, y); |
5f62b5dae8b1
Fix regression for coordinate transforms on 3-D arrays (partial fix bug #47036).
Colin Macdonald <cbm@m.fsf.org>
parents:
20158
diff
changeset
|
215 %! T = zeros (1, 1, 1, 2); |
5f62b5dae8b1
Fix regression for coordinate transforms on 3-D arrays (partial fix bug #47036).
Colin Macdonald <cbm@m.fsf.org>
parents:
20158
diff
changeset
|
216 %! T(1, 1, 1, 2) = pi/4; |
5f62b5dae8b1
Fix regression for coordinate transforms on 3-D arrays (partial fix bug #47036).
Colin Macdonald <cbm@m.fsf.org>
parents:
20158
diff
changeset
|
217 %! R = zeros (1, 1, 1, 2); |
5f62b5dae8b1
Fix regression for coordinate transforms on 3-D arrays (partial fix bug #47036).
Colin Macdonald <cbm@m.fsf.org>
parents:
20158
diff
changeset
|
218 %! R(1, 1, 1, 2) = 2; |
5f62b5dae8b1
Fix regression for coordinate transforms on 3-D arrays (partial fix bug #47036).
Colin Macdonald <cbm@m.fsf.org>
parents:
20158
diff
changeset
|
219 %! assert (t, T, eps); |
5f62b5dae8b1
Fix regression for coordinate transforms on 3-D arrays (partial fix bug #47036).
Colin Macdonald <cbm@m.fsf.org>
parents:
20158
diff
changeset
|
220 %! assert (r, R, eps); |
5f62b5dae8b1
Fix regression for coordinate transforms on 3-D arrays (partial fix bug #47036).
Colin Macdonald <cbm@m.fsf.org>
parents:
20158
diff
changeset
|
221 |
5f62b5dae8b1
Fix regression for coordinate transforms on 3-D arrays (partial fix bug #47036).
Colin Macdonald <cbm@m.fsf.org>
parents:
20158
diff
changeset
|
222 %!test |
5f62b5dae8b1
Fix regression for coordinate transforms on 3-D arrays (partial fix bug #47036).
Colin Macdonald <cbm@m.fsf.org>
parents:
20158
diff
changeset
|
223 %! [x, y, Z] = meshgrid ([0, 1], [0, 1], [0, 1]); |
5f62b5dae8b1
Fix regression for coordinate transforms on 3-D arrays (partial fix bug #47036).
Colin Macdonald <cbm@m.fsf.org>
parents:
20158
diff
changeset
|
224 %! [t, r, z] = cart2pol (x, y, Z); |
5f62b5dae8b1
Fix regression for coordinate transforms on 3-D arrays (partial fix bug #47036).
Colin Macdonald <cbm@m.fsf.org>
parents:
20158
diff
changeset
|
225 %! T(:, :, 1) = [0, 0; pi/2, pi/4]; |
5f62b5dae8b1
Fix regression for coordinate transforms on 3-D arrays (partial fix bug #47036).
Colin Macdonald <cbm@m.fsf.org>
parents:
20158
diff
changeset
|
226 %! T(:, :, 2) = T(:, :, 1); |
5f62b5dae8b1
Fix regression for coordinate transforms on 3-D arrays (partial fix bug #47036).
Colin Macdonald <cbm@m.fsf.org>
parents:
20158
diff
changeset
|
227 %! R = sqrt (x.^2 + y.^2); |
5f62b5dae8b1
Fix regression for coordinate transforms on 3-D arrays (partial fix bug #47036).
Colin Macdonald <cbm@m.fsf.org>
parents:
20158
diff
changeset
|
228 %! assert (t, T, eps); |
5f62b5dae8b1
Fix regression for coordinate transforms on 3-D arrays (partial fix bug #47036).
Colin Macdonald <cbm@m.fsf.org>
parents:
20158
diff
changeset
|
229 %! assert (r, R, eps); |
5f62b5dae8b1
Fix regression for coordinate transforms on 3-D arrays (partial fix bug #47036).
Colin Macdonald <cbm@m.fsf.org>
parents:
20158
diff
changeset
|
230 %! assert (z, Z); |
5f62b5dae8b1
Fix regression for coordinate transforms on 3-D arrays (partial fix bug #47036).
Colin Macdonald <cbm@m.fsf.org>
parents:
20158
diff
changeset
|
231 |
5f62b5dae8b1
Fix regression for coordinate transforms on 3-D arrays (partial fix bug #47036).
Colin Macdonald <cbm@m.fsf.org>
parents:
20158
diff
changeset
|
232 ## Test input validation |
28896
90fea9cc9caa
test: Add expected error message <Invalid call> to BIST tests for nargin.
Rik <rik@octave.org>
parents:
28789
diff
changeset
|
233 %!error <Invalid call> cart2pol () |
21172
5f62b5dae8b1
Fix regression for coordinate transforms on 3-D arrays (partial fix bug #47036).
Colin Macdonald <cbm@m.fsf.org>
parents:
20158
diff
changeset
|
234 %!error cart2pol (1,2,3,4) |
28171
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
235 %!error <matrix input must be 2-D numeric array> cart2pol ({1,2,3}) |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
236 %!error <matrix input must be 2-D numeric array> cart2pol (ones (3,3,2)) |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
237 %!error <matrix input must be a 2- or 3-element> cart2pol ([1]) |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
238 %!error <matrix input must be a 2- or 3-element> cart2pol ([1,2,3,4]) |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
239 %!error <must be numeric arrays or scalars> cart2pol ({1,2,3}, [1,2,3]) |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
240 %!error <must be numeric arrays or scalars> cart2pol ([1,2,3], {1,2,3}) |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
241 %!error <must be the same size or scalars> cart2pol (ones (3,3,3), ones (3,2,3)) |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
242 %!error <must be the same size or scalars> cart2pol ([1; 1], [2, 2]) |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
243 %!error <must be the same size or scalars> cart2pol ([1; 1], [2, 2], [3, 3]) |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
244 %!error <must be numeric arrays or scalars> cart2pol ({1,2,3}, [1,2,3], [1,2,3]) |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
245 %!error <must be numeric arrays or scalars> cart2pol ([1,2,3], {1,2,3}, [1,2,3]) |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
246 %!error <must be numeric arrays or scalars> cart2pol ([1,2,3], [1,2,3], {1,2,3}) |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
247 %!error <must be the same size or scalars> cart2pol (ones (3,3,3), 1, ones (3,2,3)) |
a23da76e0693
Matlab compatibility fixes for coordinate transform functions (bug #57794).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
248 %!error <must be the same size or scalars> cart2pol (ones (3,3,3), ones (3,2,3), 1) |