i need code in matlab

1 vue (au cours des 30 derniers jours)
yahai
yahai le 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 commentaires
John D'Errico
John D'Errico le 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.
yahai
yahai le 22 Nov 2022
Sorry.... I want to solve the equation on MATLAB
find the values ​​of (x,y,r)

Connectez-vous pour commenter.

Réponse acceptée

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

Connectez-vous pour commenter.

Plus de réponses (1)

Image Analyst
Image Analyst le 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);

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by