i need code in matlab
1 view (last 30 days)
Show older comments
(x-a)^2+(y-b)^2=r^2 ,,, the point (a,b) center of circle and (r) the radius ..
with point (-1,3.2) --- (-8,4)--- (-6.5,-9.3)
2 Comments
John D'Errico
on 22 Nov 2022
Hint 1: Use a loop.
Hint 2: Learn to use vectors, and arrays, to store that list of center coordinates.
Hint 3: Since this is a pretty basic question, do the MATLAB Onramp tutorials. Learn MATLAB.
Accepted Answer
Image Analyst
on 22 Nov 2022
You didn't say what you wanted to do. I'll assume you want to draw the circles on a graph. Here is the code:
x = [-1; -8; -6.5];
y = [3.2; 4; -9.3];
r = 5;
viscircles([x, y], r);
axis equal
grid on
Also see the FAQ:
More Answers (1)
Image Analyst
on 22 Nov 2022
See attached function.
x = [-1; -8; -6.5];
y = [3.2; 4; -9.3];
plot(x, y, 'b.', 'MarkerSize', 50);
% Find the center and radius of a circle going through those points.
[xCenter, yCenter, radius] = circlefit(x, y)
% Display the circle
viscircles([xCenter, yCenter], radius, 'Color', 'r');
axis equal
hold on;
% Plot center with a crosshairs
plot(xCenter, yCenter, 'r+', 'LineWidth', 2, 'MarkerSize', 100);
0 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!