Fill area of 2dcircle with cross line

5 vues (au cours des 30 derniers jours)
krishan Gopal
krishan Gopal le 10 Déc 2021
Commenté : Image Analyst le 11 Déc 2021
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')

Réponse acceptée

Matt J
Matt J le 10 Déc 2021
  2 commentaires
krishan Gopal
krishan Gopal le 11 Déc 2021
yes, crosshatch_poly works perfect
Image Analyst
Image Analyst le 11 Déc 2021
Then could you please award Matt "Reputation points" by clicking the "Accept this answer" link? Thanks in advance. 🙂

Connectez-vous pour commenter.

Plus de réponses (1)

Awais Saeed
Awais Saeed le 10 Déc 2021
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 commentaires
Awais Saeed
Awais Saeed le 10 Déc 2021
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 le 10 Déc 2021
thankyou sir

Connectez-vous pour commenter.

Catégories

En savoir plus sur AI for Wireless dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by