I have to use the "fill" funtion to plot a circel. but i cant figure out how. I need to plot two circels. A red one with radius 0.1 and a blue one with radius 0.2.

 Akzeptierte Antwort

Star Strider
Star Strider am 24 Feb. 2015

0 Stimmen

Here’s a green one with radius = 0.5 to get you started. You will also need to read the documentation on the hold function.
Example:
t = linspace(0, 2*pi);
r = 0.5;
x = r*cos(t);
y = r*sin(t);
figure(1)
fill(x, y, 'g')
axis([-1 1 -1 1])
axis square

2 Kommentare

Chad Greene
Chad Greene am 24 Feb. 2015
Stinelino: If Star Strider's solution solved your problem, kindly choose "Accept this Answer" to give credit where credit is due.
Star Strider
Star Strider am 24 Feb. 2015
Thank you, Chad!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (2)

Stinelino
Stinelino am 24 Feb. 2015

0 Stimmen

Thanks you so much! i think i'll be able to figure it out from here!
Jos (10584)
Jos (10584) am 24 Feb. 2015

0 Stimmen

You might also be interested in learning about the function rectangle, as in:
rectangle('curv',[1 1],'position',[0 0 1 1],'facecolor','b','edgecolor','b')
(Yeah, I know, sounds weird to draw a circle with rectangle ...)

2 Kommentare

Chad Greene
Chad Greene am 26 Feb. 2015
...or perhaps more intuitively, circles.
Jos (10584)
Jos (10584) am 26 Feb. 2015
nice one, Chad!

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by