[theta,rho] = cart2pol(x,y)
[theta,rho,z] = cart2pol(x,y,z)
[theta,rho] = cart2pol(x,y)
transforms data stored in Cartesian, or xy, coordinates to polar coordinates. x
and y
must be the same size. theta
is in radians.
[theta,rho,z] = cart2pol(x,y,z)
transforms data stored in Cartesian coordinates to cylindrical coordinates. x
, y
, and z
must be the same size.
t = 0:.01:2*pi;
x = cos(t).*cos(2*t).*sin(2*t);
y = sin(t).*cos(2*t).*sin(2*t);
plot(x,y), title('Cartesian')
[theta,rho] = cart2pol(x,y);
polar(theta,rho), title('Polar')
See Alsocart2sph
,pol2cart
,sph2cart
(c) Copyright 1994 by The MathWorks, Inc.