function [x, y] = polar2xy(r,theta)
% Convert polar coordinates (r,theta) to Cartesian coordinates (x,y).
% theta is in degrees.

rads= theta*pi/180;  % radian
x= r*cos(rads);
y= r*sin(rads);