I have the coordinates of the original position (x,y). I have to move at a fixed distance R from this point at a random angle between 0-360degree. How do i do this in MATLAB.
I am not looking to plot this, but just generate the new coordinate.
angle = 360*rand; % random angle between 0-360
[xv,yv] =pol2cart(angle*pi/180,R); % convert polar coordinates to cartersian
% add vector (xv, yv) to original coordinates
x2 = x + xv;
y2 = y + yv;