function [xunit yunit] = circleposition(x,y,r,d) %x and y are coordinates for the center and r = radius d= number of point th = 0:pi/(d/2):2*pi; th=th(1:end-1); xunit = r * cos(th) + x; yunit = r * sin(th) + y; % plot(xunit, yunit); end