Connecting Points with the coordinate of origin

57 views (last 30 days)
Hey there, I have got a few points placed on a circle and i want to connect them with the point of origin. Does anyone know how that works? I am really thankfull for any Ideas or Solutions.
Below u can the the points i want to connect
phi=0:1/18*pi:2*pi; rho=1000;
[x y]=pol2cart(phi,rho);
Thanks a lot in advance

Answers (2)

Image Analyst
Image Analyst on 18 Nov 2017
You you mean like this:
% Make circle.
numPoints = 37;
phi= linspace(0, 2*pi, numPoints);
rho=1000;
[x, y]=pol2cart(phi,rho);
plot(x, y, 'b.-', 'MarkerSize', 25);
grid on;
axis square;
% Now draw lines from each point to the origin.
hold on
for k = 1 : length(x)
line([0, x(k)], [0, y(k)]);
end

Star Strider
Star Strider on 18 Nov 2017
Try this:
phi=0:1/18*pi:2*pi;
rho=1000;
[x y]=pol2cart(phi,rho);
fcn = @(b,x,y) (x-b(1)).^2 + (y-b(2)).^2 - b(3).^2; % Find Center & Radius
B = fsolve(@(b) fcn(b,x,y), rand(3,1)); % Find Center & Radius
X0 = B(1);
Y0 = B(2);
R = B(3);
figure(1)
plot(x, y, '*')
hold on
plot([ones(size(x(:)))*B(1), x(:)]', [ones(size(y(:)))*B(2), y(:)]', '-r')
hold off
axis equal

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!