How Can I modify the fill command?

2 vues (au cours des 30 derniers jours)
Francesco
Francesco le 25 Fév 2014
Is there another MATLAB command like fill. If I utilize this command the output is not what I'm looking for. I want the area inside these coordinates value.
fill(coord_x, coord_y, 'r')
The code connects the points not in the way I want. Is there any other command?
  1 commentaire
Azzi Abdelmalek
Azzi Abdelmalek le 25 Fév 2014
What is the way you want?

Connectez-vous pour commenter.

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 25 Fév 2014
Modifié(e) : Azzi Abdelmalek le 25 Fév 2014
Maybe your coordinates are not correct. Look at this example
fill([0 1 1 0 0],[0 0 1 1 0],'r')
xlim([-2 2])
  9 commentaires
Francesco
Francesco le 25 Fév 2014
Image the patch command do the same! :
Azzi Abdelmalek
Azzi Abdelmalek le 25 Fév 2014
Francesco, thanks for your remarks, but accepting an answer means your problem is solved, you can vote an answer, but don't accept it until it helps you,
Try this
coord_x =[ 32.5000 32.5000 37.0000 37.5000]
coord_y =[17.5000 13.7500 16.0000 15.0000]
[idx,idx]=sort(coord_y)
fill(coord_x(idx), coord_y(idx), 'r')

Connectez-vous pour commenter.

Plus de réponses (1)

Walter Roberson
Walter Roberson le 25 Fév 2014
Find the centroid of the points. Then sort all of the points according to their polar angle relative to the centroid. If you sortrows() of the angle and the radius and then you reverse the order then it will be counter-clockwise and largest radius first, which happens to be one of the better ways of creating polygons.

Catégories

En savoir plus sur Lighting, Transparency, and Shading dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by