How do I plot a circle with a given radius and center?
Afficher commentaires plus anciens
I would like to plot a circle with a given radius and center.
Réponse acceptée
Plus de réponses (3)
serwan Bamerni
le 17 Fév 2016
Modifié(e) : MathWorks Support Team
le 26 Mai 2023
9 votes
There is now a function called viscircles():
2 commentaires
Walter Roberson
le 17 Oct 2016
This is part of the Image Processing Toolbox
Walter Roberson
le 25 Déc 2020
viscircles(app.segmented, centres, radii, 'color', 'b')
Another possibility is to approximate the circle using a polyshape with a large number of sides and plot that polyshape.
p = nsidedpoly(1000, 'Center', [2 3], 'Radius', 5);
plot(p, 'FaceColor', 'r')
axis equal
1 commentaire
Walter Roberson
le 9 Juin 2021
Remember that an equilateral triangle has a 60 degree range.
Using function "fplot" would be my simplest way:
Unit circle:
fplot(@(t) sin(t), @(t) cos(t));
grid on
Circle with center "x", "y" and radius "r":
x = 3; y = 4; r = 5;
fplot(@(t) r*sin(t)+x, @(t) r*cos(t)+y);
grid on;
Catégories
En savoir plus sur Polar Plots dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



