Can I draw the figure with the help of MATLAB code ?

조회 수: 3 (최근 30일)
Mabud Sarkar
Mabud Sarkar 2019년 8월 28일
댓글: Star Strider 2020년 8월 20일
I want to figure out the following graph to show map between two annular region as follows:
image 1.jpg
Here B is subset of A and we want to show the map from (A - B) to B.
How do I plot this graph?
Can I draw the figure with the help of MATLAB code or Mathematica ?
In that case what would be the Matlab Code ?
Help me

채택된 답변

Star Strider
Star Strider 2019년 8월 28일
Try this:
circx = @(r,a) r.*cos(a);
circy = @(r,a) r.*sin(a);
a = linspace(0, 2*pi);
figure
fill(0.2*circx(1,a)-0.5, 0.2*circy(1,a), 'g')
hold on
fill(0.1*circx(1,a)-0.5, 0.1*circy(1,a), 'w')
fill(0.2*circx(1,a)+0.5, 0.2*circy(1,a), 'g')
fill(0.1*circx(1,a)+0.5, 0.1*circy(1,a), 'w')
hold off
axis equal
xlim([-1 1])
annotation('textarrow',[0.35, 0.7], [0.58, 0.58])
text(-0.6, 0.15, 'A-B')
text([-0.5 0.5], [0 0], 'B', 'HorizontalAlignment','center')
text(0, 0.2, '\itf\rm', 'FontSize',15)
Experiment to get the result you want.
Can I draw the figure with the help of MATLAB code - 2019 08 28.png
  댓글 수: 8
Mabud Sarkar
Mabud Sarkar 2020년 8월 20일
편집: Mabud Sarkar 2020년 8월 20일
In your 1st answer, you used
text([-0.5 0.5], [0 0], 'B', 'HorizontalAlignment','center')
Why did you use both [-0.5 0.5] and [0 0] ?
But in the previous line you used only
text(-0.6, 0.15, 'A-B')
Can you please explain the above ?
Second question,
why in case of annotation textarrow, we are allowed only points between 0 and 1 ?
Why not negative points ?
Star Strider
Star Strider 2020년 8월 20일
They are two separate text calls displaying two different strings.
The ‘B’ is displayed twice, once in each circle, so two positions, one for each. (I could have used two different text calls. Using one text call with two coordinates is more efficient.)
The ‘A-B’ is displayed once, so it only needs one set of coordinates.

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

추가 답변 (2개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 8월 28일
편집: KALYAN ACHARJYA 2019년 8월 28일
Please note: I have done the Jugaad here. I have no idea what the plot represents?
I tried it for 10 minutes, hence I posted it as 2nd answer.
x=[5,5,15,15];
y=[5,5,5,5];
r=[2,1,2,1];
theta=0:pi/50:2*pi;
for i=1:4
x_circle=r(i)*cos(theta)+x(i);
y_circle = r(i)*sin(theta)+y(i);
plot(x_circle,y_circle);
if r(i)==max(r)
h=fill(x_circle,y_circle,'g');
else
h=fill(x_circle,y_circle,'w');
end
hold on;
end
text(x(1),y(1)+3,'A');
text(x(1),y(1)+1.5,'A-B');
text(x(3),y(3)+3,'A');
text(x(1),y(1),'B');
text(x(3),y(3),'B');
quiver(x(1)+1.3,y(1),10,0);
text(10,5.3,'f');
234.png
  댓글 수: 1
Mabud Sarkar
Mabud Sarkar 2019년 8월 28일
편집: Mabud Sarkar 2019년 8월 28일
Thank you for your answer. But how the arrow will touch the circle B ?
Actually this figures represnts mapping between two annular region in Complex analysis of M.Sc. mathematics ?

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


Steven Lord
Steven Lord 2019년 8월 28일
A regular N-sided polygon (for large N) is visually indistinguishable from a circle. Try:
>> A = nsidedpoly(1000, 'Center', [0 0], 'Radius', 2);
>> B = nsidedpoly(1000, 'Center', [0 0], 'Radius', 1);
>> C = subtract(A, B);
>> plot(C, 'FaceColor', 'g')
>> axis equal
To make copies of the polyshape objects A and B at a different location, call translate on them (specifying a different variable name as output.) See this documentation page for more functions that you can use to operate on polyshape objects.
For the arrow, call annotation. For the letters, call text.
  댓글 수: 1
Mabud Sarkar
Mabud Sarkar 2019년 8월 28일
Please add the rest code because I can not get it at the beginning. However I will grasp the code for future. So please add the complete code with the figure.

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

카테고리

Help CenterFile Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by