function [mag, angle] = polar_value(x,y)
%POLAR_VALUE Converts (x,y) to (r,theta)
% ...
% ...

msg = nargchk(1, 2, nargin);
error(msg);

if nargin < 2
   y = 0;
end

if x == 0 & y == 0
   msg = 'Both x and y are zero: angle is meaningless!';
   warning(msg);
end

mag = sqrt(x .^2 + y .^2);

if nargout == 2
   disp('Generating the angle!')
   angle = atan2(y,x) * 180/pi;
end

end

