Mercurial > hg > octave-lyh
comparison scripts/plot/__plr2__.m @ 5115:57372235194b
[project @ 2005-01-24 18:38:45 by jwe]
author | jwe |
---|---|
date | Mon, 24 Jan 2005 18:38:45 +0000 |
parents | 22bd65326ec1 |
children | 67320fb4ae5c |
comparison
equal
deleted
inserted
replaced
5114:cda8c0a823c5 | 5115:57372235194b |
---|---|
39 | 39 |
40 if (isscalar (theta)) | 40 if (isscalar (theta)) |
41 if (isscalar (rho)) | 41 if (isscalar (rho)) |
42 x = rho * cos (theta); | 42 x = rho * cos (theta); |
43 y = rho * sin (theta); | 43 y = rho * sin (theta); |
44 __plt2ss__ (x, y, fmt); | 44 __plt__ (x, y, fmt); |
45 else | |
46 error ("__plr2__: invalid data for plotting"); | |
45 endif | 47 endif |
46 elseif (isvector (theta)) | 48 elseif (isvector (theta)) |
47 if (isvector (rho)) | 49 if (isvector (rho)) |
48 if (length (theta) != length (rho)) | 50 if (length (theta) != length (rho)) |
49 error ("polar: vector lengths must match"); | 51 error ("__plr2__: vector lengths must match"); |
50 endif | 52 endif |
51 if (rows (rho) == 1) | 53 if (rows (rho) == 1) |
52 rho = rho'; | 54 rho = rho'; |
53 endif | 55 endif |
54 if (rows (theta) == 1) | 56 if (rows (theta) == 1) |
55 theta = theta'; | 57 theta = theta'; |
56 endif | 58 endif |
57 x = rho .* cos (theta); | 59 x = rho .* cos (theta); |
58 y = rho .* sin (theta); | 60 y = rho .* sin (theta); |
59 __plt2vv__ (x, y, fmt); | 61 __plt__ (x, y, fmt); |
60 elseif (ismatrix (rho)) | 62 elseif (ismatrix (rho)) |
61 [t_nr, t_nc] = size (theta); | 63 [t_nr, t_nc] = size (theta); |
62 if (t_nr == 1) | 64 if (t_nr == 1) |
63 theta = theta'; | 65 theta = theta'; |
64 tmp = t_nr; | 66 tmp = t_nr; |
71 tmp = r_nr; | 73 tmp = r_nr; |
72 r_nr = r_nc; | 74 r_nr = r_nc; |
73 r_nc = tmp; | 75 r_nc = tmp; |
74 endif | 76 endif |
75 if (t_nr != r_nr) | 77 if (t_nr != r_nr) |
76 error ("polar: vector and matrix sizes must match"); | 78 error ("__plr2__: vector and matrix sizes must match"); |
77 endif | 79 endif |
78 x = diag (cos (theta)) * rho; | 80 x = diag (cos (theta)) * rho; |
79 y = diag (sin (theta)) * rho; | 81 y = diag (sin (theta)) * rho; |
80 __plt2vm__ (x, y, fmt); | 82 __plt__ (x, y, fmt); |
83 else | |
84 error ("__plr2__: invalid data for plotting") | |
81 endif | 85 endif |
82 elseif (ismatrix (theta)) | 86 elseif (ismatrix (theta)) |
83 if (isvector (rho)) | 87 if (isvector (rho)) |
84 [r_nr, r_nc] = size (rho); | 88 [r_nr, r_nc] = size (rho); |
85 if (r_nr == 1) | 89 if (r_nr == 1) |
94 tmp = t_nr; | 98 tmp = t_nr; |
95 t_nr = t_nc; | 99 t_nr = t_nc; |
96 t_nc = tmp; | 100 t_nc = tmp; |
97 endif | 101 endif |
98 if (r_nr != t_nr) | 102 if (r_nr != t_nr) |
99 error ("polar: vector and matrix sizes must match"); | 103 error ("__plr2__: vector and matrix sizes must match"); |
100 endif | 104 endif |
101 diag_r = diag (rho); | 105 diag_r = diag (rho); |
102 x = diag_r * cos (theta); | 106 x = diag_r * cos (theta); |
103 y = diag_r * sin (theta); | 107 y = diag_r * sin (theta); |
104 __plt2mv__ (x, y, fmt); | 108 __plt__ (x, y, fmt); |
105 elseif (ismatrix (rho)) | 109 elseif (ismatrix (rho)) |
106 if (size (rho) != size (theta)) | 110 if (size (rho) != size (theta)) |
107 error ("polar: matrix dimensions must match"); | 111 error ("__plr2__: matrix dimensions must match"); |
108 endif | 112 endif |
109 x = rho .* cos (theta); | 113 x = rho .* cos (theta); |
110 y = rho .* sin (theta); | 114 y = rho .* sin (theta); |
111 __plt2mm__ (x, y, fmt); | 115 __plt__ (x, y, fmt); |
116 else | |
117 error ("__plr2__: invalid data for plotting") | |
112 endif | 118 endif |
119 else | |
120 error ("__plr2__: invalid data for plotting") | |
113 endif | 121 endif |
114 | 122 |
115 endfunction | 123 endfunction |