Effacer les filtres
Effacer les filtres

display fix radius circles

3 vues (au cours des 30 derniers jours)
Jordan
Jordan le 29 Juil 2021
Commenté : dpb le 10 Août 2021
I wanna to put fix radius circles at (0,1),(1,1),(2,1),(3,1) with diameter of 1 at same time. Is there any way can achieve this?
  2 commentaires
dpb
dpb le 29 Juil 2021
Yeah, but MATLAB incredibly doesn't have a graphics circle object nor defined circle-plotting function.
rectangle (of all things!) can draw circles, but is also neutered and defies the documentation in that it won't accept anything that goes to the negative side of an axis so you can't use it to draw the circle on the y-axis at the origin.
You have to define the parametric values or x,y in cartesian coordinates from the r*sin(th), r*cos(th) instead.
I'm sure there are some FEX functions.
But, it is one of those absolute mysteries that are totally unfathomable.
figure
pos = [-1 1 -1 1];
xlim([-10 10]),ylim([-10 10]),axis equal
axis equal
rectangle('Position',pos,'Curvature',[1 1])
Error using rectangle
Width and height must be greater than or equal to 0
>>
>> doc rectangle
says
"pos — Size and location of rectangle
four-element vector of the form [x y w h]
Size and location of the rectangle, specified as a four-element vector of the form [x y w h]. The x and y elements define the coordinate for the lower left corner of the rectangle. The w and h elements define the dimensions of the rectangle.
All values are in data units."
The above are all in data units within the limits of the defined axes but aren't allowed.
dpb
dpb le 10 Août 2021
function hL = circle(x0,y0,r)
th = 0:pi/100:2*pi;
x = r * cos(th) + x0;
y = r * sin(th) + y0;
hL=plot(x,y);
end
is a most rudimentary illustration of generating the circle cartesian coordinates...

Connectez-vous pour commenter.

Réponses (1)

Sivani Pentapati
Sivani Pentapati le 4 Août 2021
As per my knowledge, you can use the viscricles function to plot 4 circles at the same time
Refer to the below code for your usecase:
viscircles([0,1;1,1;2,1;3,1],0.5*ones(4,1))
where you pass in an array, with center co-ordinates, (0,1),(1,1),(2,1),(3,1) as the first argument and radii, 0.5 as the second argument
  1 commentaire
dpb
dpb le 9 Août 2021
NB: visicircles is in Image Processing Toolbox, not base MATLAB.
Which is fine for those who have the TB, not so much if don't.

Connectez-vous pour commenter.

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by