Filter löschen
Filter löschen

How to draw a white circle ?

13 Ansichten (letzte 30 Tage)
K BV
K BV am 29 Okt. 2012
Hello,
I would like to draw a white circle in a black square in Matlab but I don't have any idea how to do it. Would you please explain me how to do it ?
In advance, thank you !

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 29 Okt. 2012
Bearbeitet: Azzi Abdelmalek am 29 Okt. 2012
r=4; %radius
x0=0;y0=0; % circle center coordinates
x=x0-r:0.01:x0+r
y=sqrt(r^2-(x-x0).^2)+y0;
fill([x0-r x0+r x0+r x0-r ],[y0-r y0-r y0+r y0+r ],'k')
hold on;
plot(x,y,'w',x,-y,'w');
axis square
axis([x0-2*r x0+2*r y0-2*r y0+2*r]) % facultative
  3 Kommentare
Azzi Abdelmalek
Azzi Abdelmalek am 29 Okt. 2012
Yes
fill([x fliplr(x)],[y fliplr(-y)],'w')
Azzi Abdelmalek
Azzi Abdelmalek am 29 Okt. 2012
x=x0-r:0.01:x0+r
is a vector of points we are using to plot your circle

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Image Analyst
Image Analyst am 30 Okt. 2012
  1 Kommentar
K BV
K BV am 30 Okt. 2012
Thanks for the link ! I'll search in the FAQs the next time before asking any question ;)

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by