Navigation

Operators and Keywords

Function List:

C++ API

Function File: [F, D] = forcematrix (pos, A,funcs)

Evaluates a force function depending on the separation of multiple interacting points.

INPUT

  • pos is a Nxdim array of positions. N is the number of points and dim the dimension. Each row represent a different point.
  • A is the a connectivity (adjacency) matrix expressed as a vector. That is, if M is the complete NxN symmetric connectivity matrix, then A= vech(M). The diagonal of M is not used. The elements of A are indexes to the corresponding interaction force in funcs. For example, there are 3 points and points 2 and 3 interact with a force described in the 5th element of funcs, then M(2, 3) = 5.
  • funcs is a Nfx1 cell. Elements that are matrices are evaluated with polyval. elements that are function handles are evaluated directly. Functions handles must be of the form @(x)f(x), where x is the distance between two interacting points.

OUTPUT

  • F is a Nxdim array of forces acting on each point.
  • D is an array in the same format as A containing the euclidean distances between the points.