Plotting a Hexagon shape in matlab
27 ビュー (過去 30 日間)
古いコメントを表示
Aftab Ahmed Khan
2014 年 6 月 18 日
コメント済み: Aftab Ahmed Khan
2014 年 6 月 18 日
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/164497/image.png)
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.
採用された回答
David Sanchez
2014 年 6 月 18 日
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 件のコメント
Image Analyst
2014 年 6 月 18 日
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.
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!