# i need code in matlab

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

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

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
% Display the circle
axis equal
hold on;
% Plot center with a crosshairs
plot(xCenter, yCenter, 'r+', 'LineWidth', 2, 'MarkerSize', 100);

### Categories

Find more on Surface and Mesh Plots 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!