How to draw a white circle ?

조회 수: 13 (최근 30일)
K BV
K BV 2012년 10월 29일
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 !

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2012년 10월 29일
편집: Azzi Abdelmalek 2012년 10월 29일
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
Azzi Abdelmalek
Azzi Abdelmalek 2012년 10월 29일
Yes
fill([x fliplr(x)],[y fliplr(-y)],'w')
Azzi Abdelmalek
Azzi Abdelmalek 2012년 10월 29일
x=x0-r:0.01:x0+r
is a vector of points we are using to plot your circle

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2012년 10월 30일
  댓글 수: 1
K BV
K BV 2012년 10월 30일
Thanks for the link ! I'll search in the FAQs the next time before asking any question ;)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by