0

I have a N-dimensional vector, X and 'n' equidistant points along each dimension and a parameter 'delta'. I need a way to find the total of n^N vectors enclosed by the Hypercube defined with the vector X at the center and each side of Hypercube being of size 2*delta.

For example:

Consider a case of N=3, so we have a Cube of size (2*delta) enclosing the point X.

------------\
|\--------|--\
| |   X   |  |
-----------  |
\ |_2*del___\|

Along each dimension I have 'n' points. So, I have a total of n^3 vectors around X. I need to find all the vectors. Is there any standard algorithm/method for the same? If you have done anything similar, please suggest.

If the problem is not clear, let me know.

This is what I was looking at: Considering one dimension, length of a side is 2*delta and I have n divisions. So, each sub-division is of size (2*delta/n). So I just move to the origin that is (x-delta) (since x is the mid point of the side) and obtain the 'n' points by {(x-delta) + 1*(2*delta/n),(x-delta) + 2*(2*delta/n)....+ (x-delta) + 1*(n*delta/n) } . I do this for all the N-dimensions and then take a permutation of the co-ordinates. That way I have all the points.

(I would like to close this)

4

2 回答 2

1

如果我正确理解您的问题,您有一个以 X 点为中心的轴对齐超立方体,并且您已将此超立方体的内部细分为一个规则格子,其中格点和间距位于超立方体的坐标系中。你所要做的就是让 X = 0,找到每个格点的向量,然后返回并用 X 平移它们。

编辑:让我添加一个示例

让 x = (5,5,5),delta = 1 和 n = 3

然后,将 x 移动到原点,你的格点是 (-1, -1, -1), (0, -1, -1), (1, -1, -1) 等等,总共 27 . 翻译回来,我们有 (4, 4, 4), (5, 4, 4), (6, 4, 4) 等等。

于 2009-10-12T15:29:57.340 回答
0

好的,我没有完全理解你的问题。2^(N-1)*N在 N 维超立方体中,关于一个点总共有“线”。

如果您只想在看起来像轴的线上创建 n 个点,但在距原点 delta 的距离处平移,这里有一些(为了清楚起见,写得不好)MATLAB代码:

n = 10;
delta = 10;
N = 3;
step = (2*delta)/(n-1);
P = zeros(n,N,N);
X = [20 30 25];

for line_dim = 1:N
 for point = 1:n
  for point_dim = 1:N

   if(point_dim ~= line_dim) 
    P(point,point_dim,line_dim) = X(point_dim)-delta;
   else 
    P(point,point_dim,line_dim) = X(point_dim)-delta+step*(point-1);
   end

  end
 end
end

该代码适用于立方体,但它应该适用于任何 N。我所做的只是:

  1. 在轴上画出这 n 个等距点。
  2. 通过 (X-delta) 平移轴

展示:

% Display stuff    
PP = reshape(permute(P,[1 3 2]),[n*N N]);
plot3(X(1),X(2),X(3),'r*',PP(:,1),PP(:,2),PP(:,3),'.')
axis([0 Inf 0 Inf 0 Inf]);
grid on;
于 2009-10-12T14:37:19.913 回答