Filter löschen
Filter löschen

Plotting a Hexagon shape in matlab

17 Ansichten (letzte 30 Tage)
Aftab Ahmed Khan
Aftab Ahmed Khan am 18 Jun. 2014
Kommentiert: Aftab Ahmed Khan am 18 Jun. 2014
Hi everyone, I have this user distribution on the plane (as shown in the figure). I want to draw a Hexagon shape around these marks. Don't know how to put in there. Thank you so much.
  1 Kommentar
Aftab Ahmed Khan
Aftab Ahmed Khan am 18 Jun. 2014
Even, i have managed to do this, but how can i make all the users inside of this hexagon.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

David Sanchez
David Sanchez am 18 Jun. 2014
To Draw any polygon:
scale = 5;
N_sides = 6;
t=(1/(N_sides*2):1/N_sides:1)'*2*pi;
x=sin(t);
y=cos(t);
x=scale*[x; x(1)];
y=scale*[y; y(1)];
plot(x,y)
axis square
Now just hold on and off your data plot. Adjust the scale to your data
  3 Kommentare
Image Analyst
Image Analyst am 18 Jun. 2014
You might want to look at convhull() - a related function that gives a boundary like you'd get if you wrapped a rubber band around your points.
Aftab Ahmed Khan
Aftab Ahmed Khan am 18 Jun. 2014
Yes, that was also useful.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by