How to color the area bounded by several circles?

8 次查看(过去 30 天)
Hello all,
I have drawn 3 half-circles (Mohr circles) and wanting to shade the area bounded by them as indicated in the attached picture. This is my code for creating these half-circles:
theta = 0:1/1000*pi:pi;
R1 = (SHmax-Shmin)/2; %first mohr circle
C1 = Shmin+R1;
x1 = cos(theta)*R1+C1;
y1 = sin(theta)*R1;
R2 = (Sv-Shmin)/2; %second mohr circle
C2 = Shmin+R2;
x2 = cos(theta)*R2+C2;
y2 = sin(theta)*R2;
R3 = (SHmax-Sv)/2; %third mohr circle
C3 = Sv+R3;
x3 = cos(theta)*R3+C3;
y3 = sin(theta)*R3;
figure (1)
hold on
plot(x1,y1)
plot(x2,y2)
plot(x3,y3)
I have tried using fill() and patch() but am new to programming and could not figure out how to correctly use them. Can someone please help me out? Thank you very much!!

采纳的回答

Walter Roberson
Walter Roberson 2020-9-17
Fx= [x1,fliplr(x2),fliplr(x3)];
Fy = [y1,fliplr(y2),fliplr(y3)];
fill(Fx, Fy);
Tested with input values I made up. For your input values, it is possible that you might need to flip or not flip different arrays.
  4 个评论
Walter Roberson
Walter Roberson 2020-9-17
fill() is actually a patch() and patch() can do that if you set the correct properties.
However by that point you might as well go ahead and use patch() directly.
JoLin
JoLin 2020-9-17
Ok I see, will give it a try, thanks alot for the help!

请先登录,再进行评论。

更多回答(0 个)

类别

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