How can I change the distances between points in a hexagonal grid?

1 view (last 30 days)
I'm trying to project some vectors in a hexagonal grid which is done with the hextop function.
Does anybody know how to change the distance between th points in the hexagonal grid?
vpos=[8,8];
pos=hextop(vpos);

Answers (1)

Kiran Felix Robert
Kiran Felix Robert on 14 Aug 2020
Hi Clara,
It is my understanding that you are trying to scale the hexagonal grid created by the hextop function. The output of the hextop function is a 2-by-N matrix such that, Row 1 corresponds to the x-value and Row-2 corresponds to the y-Value in a rectangular grid. So, to scale the grid, you can scale the grid points in the ‘pos’ vector by the required scaling factor.
For example, if you want to scale the horizontal distance by ‘a’ and vertical distance by ‘b’, this can be done as shown below,
vpos = [8,8];
pos = hextop(vpos);
pos(1,:) = pos(1,:).*a;
pos(2,:) = pos(2,:).*b;
Hope this Helps.
Kiran Felix Robert
  1 Comment
Clara Luque Rioja
Clara Luque Rioja on 16 Aug 2020
Hi, Kiran
Thank you for the answer. I have tried this option but if I try to plot it with the plotsom function I don't obtain an hexagonal grid.
Thank yo anyway.
Clara

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!