function [r,theta] = cart2plr(x,y)
% Convert Cartesian coordinates to polar coordinates
% usage: [r,theta] = cart2plr(x,y) computes r and theta from cartesian
% coordinates. x and y can be vectors but they must be the same length
%
% r = sqrt(x^2 + y^2);
% theta = atan2(y,x);

r = sqrt(x.^2 + y.^2);
theta = atan2(y,x);