I want to draw a circle on the image in MATLAB. Please help me how to draw it.

152 ビュー (過去 30 日間)
Monika Rani
Monika Rani 2021 年 8 月 3 日
回答済み: Benjamin Kraus 2021 年 8 月 3 日
The sample image is attached here. Like here the red dotted circle is drawn accoring to the radius of the black solid curve.

回答 (1 件)

Benjamin Kraus
Benjamin Kraus 2021 年 8 月 3 日
You can draw circles in MATLAB using the rectangle command and setting the Curvature to [1 1]. (I know, it is a little strange to use the rectangle command to draw circles).
For example, to draw a circle at center [2 3] with a radius of 1.5, you could use the following code.
(Note, you can condense this all down to one line of code, but I've written it using several variables so you can see where all the numbers are coming from.)
center = [2 3];
radius = 1.5;
x = center(1) - radius;
y = center(2) - radius;
w = radius * 2;
h = radius * 2;
pos = [x y w h];
cur = [1 1];
rectangle('Position',pos,'Curvature',cur)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by