i need code in matlab

3 views (last 30 days)
yahai
yahai on 22 Nov 2022
Answered: Image Analyst on 22 Nov 2022
(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
yahai
yahai on 22 Nov 2022
Sorry.... I want to solve the equation on MATLAB
find the values ​​of (x,y,r)

Sign in to comment.

Accepted Answer

Image Analyst
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:
  1 Comment
yahai
yahai on 22 Nov 2022
Sorry.... I want to solve the equation on MATLAB
find the values ​​of (x,y,r)

Sign in to comment.

More Answers (1)

Image Analyst
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)
xCenter = -5.1877
yCenter = -2.4174
radius = 7.0066
% 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);

Products

Community Treasure Hunt

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

Start Hunting!