
Connecting Points with the coordinate of origin
8 views (last 30 days)
Show older comments
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
0 Comments
Answers (2)
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

0 Comments
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
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!