I am wondering how I can draw circle seperated by two color...

조회 수: 4 (최근 30일)
Haksun Lee
Haksun Lee 2012년 10월 25일
Hi.. all
As has been mentioned at title, I'd like to draw circle with two color.
For example, upper half circle is red color and lower half circle is blue color.
Which code can I use to draw this circle?
Thank you for reading my writing...
Have a nice day!

답변 (2개)

Azzi Abdelmalek
Azzi Abdelmalek 2012년 10월 25일
편집: Azzi Abdelmalek 2012년 10월 25일
x=-1:0.01:1
y1=sqrt(1-x.^2)
plot(y1,'r')
hold on
plot(-y1,'b')
or more general
c=1+2j % circle centre
r=4 % radius
x=real(c)-r:0.01:real(c)+r
y1=sqrt(r^2-(x-real(c)).^2)+imag(c)
plot(x,y1,'r')
hold on
plot(x,-y1+2*imag(c),'b')
axis square

Haksun Lee
Haksun Lee 2012년 10월 25일
Hi! Azzi Abdelmalek.. Thank your for your reply... I resolved the problem complete thanks to you..but I have another question.
Utimately, I am planning to draw two colored circle(including gray, yellow) of folling picture.
Using above reply, which code can I use to draw special circle?
I'd like to accept advice from many people as far as possible.
  댓글 수: 1
Azzi Abdelmalek
Azzi Abdelmalek 2012년 10월 25일
If you've resolved the problem then repost another question

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

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by