comparison scripts/plot/__plr__.m @ 5116:67320fb4ae5c

[project @ 2005-01-25 03:57:01 by jwe]
author jwe
date Tue, 25 Jan 2005 03:57:01 +0000
parents 57372235194b
children 4c8a2e4e0717
comparison
equal deleted inserted replaced
5115:57372235194b 5116:67320fb4ae5c
57 endif 57 endif
58 if (isscalar (theta)) 58 if (isscalar (theta))
59 if (isscalar (rho)) 59 if (isscalar (rho))
60 x = rho * cos (theta); 60 x = rho * cos (theta);
61 y = rho * sin (theta); 61 y = rho * sin (theta);
62 __plt__ (x, y, fmt); 62 __plt__ ("polar", x, y, fmt);
63 endif 63 endif
64 elseif (isvector (theta)) 64 elseif (isvector (theta))
65 if (isvector (rho)) 65 if (isvector (rho))
66 if (length (theta) != length (rho)) 66 if (length (theta) != length (rho))
67 error ("polar: vector lengths must match"); 67 error ("polar: vector lengths must match");
72 if (rows (theta) == 1) 72 if (rows (theta) == 1)
73 theta = theta.'; 73 theta = theta.';
74 endif 74 endif
75 x = rho .* cos (theta); 75 x = rho .* cos (theta);
76 y = rho .* sin (theta); 76 y = rho .* sin (theta);
77 __plt__ (x, y, fmt); 77 __plt__ ("polar", x, y, fmt);
78 elseif (ismatrix (rho)) 78 elseif (ismatrix (rho))
79 [t_nr, t_nc] = size (theta); 79 [t_nr, t_nc] = size (theta);
80 if (t_nr == 1) 80 if (t_nr == 1)
81 theta = theta.'; 81 theta = theta.';
82 tmp = t_nr; 82 tmp = t_nr;
93 if (t_nr != r_nr) 93 if (t_nr != r_nr)
94 error ("polar: vector and matrix sizes must match"); 94 error ("polar: vector and matrix sizes must match");
95 endif 95 endif
96 x = diag (cos (theta)) * rho; 96 x = diag (cos (theta)) * rho;
97 y = diag (sin (theta)) * rho; 97 y = diag (sin (theta)) * rho;
98 __plt__ (x, y, fmt); 98 __plt__ ("polar", x, y, fmt);
99 endif 99 endif
100 elseif (ismatrix (theta)) 100 elseif (ismatrix (theta))
101 if (isvector (rho)) 101 if (isvector (rho))
102 [r_nr, r_nc] = size (rho); 102 [r_nr, r_nc] = size (rho);
103 if (r_nr == 1) 103 if (r_nr == 1)
117 error ("polar: vector and matrix sizes must match"); 117 error ("polar: vector and matrix sizes must match");
118 endif 118 endif
119 diag_r = diag (r); 119 diag_r = diag (r);
120 x = diag_r * cos (theta); 120 x = diag_r * cos (theta);
121 y = diag_r * sin (theta); 121 y = diag_r * sin (theta);
122 __plt__ (x, y, fmt); 122 __plt__ ("polar", x, y, fmt);
123 elseif (ismatrix (rho)) 123 elseif (ismatrix (rho))
124 if (size (rho) != size (theta)) 124 if (size (rho) != size (theta))
125 error ("polar: matrix dimensions must match"); 125 error ("polar: matrix dimensions must match");
126 endif 126 endif
127 x = rho .* cos (theta); 127 x = rho .* cos (theta);
128 y = rho .* sin (theta); 128 y = rho .* sin (theta);
129 __plt__ (x, y, fmt); 129 __plt__ ("polar", x, y, fmt);
130 endif 130 endif
131 endif 131 endif
132 else 132 else
133 usage ("__plr__ (x, y)"); 133 usage ("__plr__ (x, y)");
134 endif 134 endif