Transform Cartesian to polar coordinates
[phi,p,z]=cart2pol(x,y,z)
x,y,z coordinates
azimuth angle
radius in xy plane
cart2pol(x,y,z) transforms corresponding elements of data stored in Cartesian coordinates X,Y,Z to cylindrical coordinates (radius p, azimuth angle phi). phi is returned in radians. The arrays X,Y, and Z must be the same size (or any of them can be scalar).
add sample pgm