Fill area of 2dcircle with cross line

1 回表示 (過去 30 日間)
krishan Gopal
krishan Gopal 2021 年 12 月 10 日
コメント済み: Image Analyst 2021 年 12 月 11 日
below is simple circle code, can anyone tell me how to fill this circle with line pattern.
theta=linspace(0,2*pi,100);
x=cos(theta);
y=sin(theta);
plot(x,y)
axis('equal');
xlabel('x')
ylabel('y')
title('circle of unit radius')

採用された回答

Matt J
Matt J 2021 年 12 月 10 日
  2 件のコメント
krishan Gopal
krishan Gopal 2021 年 12 月 11 日
yes, crosshatch_poly works perfect
Image Analyst
Image Analyst 2021 年 12 月 11 日
Then could you please award Matt "Reputation points" by clicking the "Accept this answer" link? Thanks in advance. 🙂

サインインしてコメントする。

その他の回答 (1 件)

Awais Saeed
Awais Saeed 2021 年 12 月 10 日
Do not know how to fill with lines, but you can fill the circle as shown below
theta=linspace(0,2*pi,100);
x=cos(theta);
y=sin(theta);
fill(x,y,'g')
axis('equal');
xlabel('x')
ylabel('y')
title('circle of unit radius')
  3 件のコメント
Awais Saeed
Awais Saeed 2021 年 12 月 10 日
Not exactly the same but somewhat near to the desired output
theta=linspace(0,2*pi,100);
x=cos(theta);
y=sin(theta);
plot(x,y,'black')
for ii = 1:2:length(x)
line([-y(ii),x(ii)],[-x(ii),y(ii)],'Color', 'black','LineWidth',1)
end
axis('equal');
xlabel('x')
ylabel('y')
title('circle of unit radius')
krishan Gopal
krishan Gopal 2021 年 12 月 10 日
thankyou sir

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by