display fix radius circles
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
dpb
am 29 Jul. 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
am 10 Aug. 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...
Antworten (1)
Sivani Pentapati
am 4 Aug. 2021
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 Kommentar
dpb
am 9 Aug. 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.
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!