function [r,theta] = cart_to_polar(x,y)
% convert Cartesian coordinates to polar
r = sqrt(x^2 + y^2);
theta = atan2(x,y);

