Contents     Functions         Previous Next     PDF Index



Coordinate system handling utilities


p         = basis(x,y)
[bas,x]   = basis(node)
[ ... ]   = basis('Command', ... )


nodebas [nodeGlob,bas]=basis('nodebas',model)

NodeBas performs a local to global node transformation with recursive transformation of coordinate system definitions stored in bas. Column 2 in nodeLocal is assumed give displacement coordinate system identifiers PID matching those in the first column of bas. [nodeGlobal,bas]= basis(nodeLocal,bas) is an older acceptable format. -force is a command option used to resolve all dependencies in bas even when no local coordinates are used in node.

Coordinate systems are stored in a matrix where each row represents a coordinate system using any of the three formats

 % different type of coordinate defintition
 CorID Type RefID A1   A2   A3   B1 B2 B3 C1 C2 C3 0  0  0  s
 CorID Type 0     NIdA NIdB NIdC 0  0  0  0  0  0  0  0  0  s
 CorID Type 0     Ax Ay Az       Ux Uy Uz Vx Vy Vz Wx Wy Wz s

Supported coordinate types are 1 rectangular, 2 cylindrical, 3 spherical. For these types, the nodal coordinates in the initial nodeLocal matrix are x y z, r teta z, r teta phi respectively.

Figure 10.1: Coordinates convention.

The first format defines the coordinate system by giving the coordinates of three nodes A, B, C as shown in the figure above. These coordinates are given in coordinate system RefID which can be 0 (global coordinate system) or another CordId in the list (recursive definition).

The second format specifies the same nodes using identifiers NIdA, NIdB, NIdC of nodes defined in node.

The last format gives, in the global reference system, the position Ax Ay Az of the origin of the coordinate system and the directions of the x, y and z axes. When storing these vectors as columns one thus builds the xG=[cGL]xL transform.

The s scale factor can be used to define position of nodes using two different unit systems. This is used for test/analysis correlation. The scale factor has no effect on the definition of displacement coordinate systems.

trans[ ,t][ ,l][,e] cGL= basis('trans [ ,t][ ,l][,e]',bas,node,DOF)

The transformation basis for displacement coordinate systems is returned with this call. Column 3 in node is assumed give displacement coordinate system identifiers DID matching those in the first column of bas.

By default, node is assumed to be given in global coordinates. The l command option is used to tell basis that the nodes are given in local coordinates.

Without the DOF input argument, the function returns a transformation defined at the 3 translations and 3 rotations at each node. The t command option restricts the result to translations. With the DOF argument, the output is defined at DOFs in DOF.

The e command option (for elimination) returns a square transformation matrix. Warning: use of the transE command and the resulting transformation matrix can only be orthogonal for translation DOF if all three translation DOF are present.

gnode:nodeGlobal = basis('gnode',bas,nodeLocal)

Given a single coordinate system definition bas, associated nodes nodeLocal (with coordinates x y z, r teta z, r teta phi for Cartesian, cylindrical and spherical coordinate systems respectively) are transformed to the global Cartesian coordinate system. This is a low level command used for the global transformation [node,bas] = basis(node,bas).

bas can be specified as a string compatible with a basis('rotate' call. In such case, the actual basis is generated on the fly by basis('rotate') before applying the node transformation.

[p,nodeL] = basis(node)

Element basis computation With two output arguments and an input node matrix, basis computes an appropriate local basis bas and node positions in local coordinates x. This is used by some element functions (quad4) to determine the element basis.


bas=basis('rotate',bas,'command',basId); is used to perform rotations on coordinate systems of bas given by their basId. command is a string to be executed defining rotation in degrees (rx=45; defines a 45 degrees rotation along x axis). One can define more generally rotation in relation to another axis defining angle r=angle and axis n=[nx,ny,nz]. It is possible to define translations (an origin displacement) by specifying in command translation values under names tx, ty and tz, using the same formalism than for rotations.

For example, one can define a basis using

% Sample basis defintion commands
bas=basis('rotate',[],'rz=30;',1); % 30 degrees / z axis
bas=basis('rotate',[],'r=30;n=[0 1 1]',1); % 30 degrees / [0 1 1] axis 
bas=basis('rotate',[],'tx=12;',1); % translation of 12 along x
bas=basis('rotate',[],'ty=24;r=15;n=[1 1 1];',1); % translation of 24 along y and rotation

p = basis(x,y)

Basis from nodes (typically used in element functions to determine local coordinate systems). x and y are two vectors of dimension 3 (for finite element purposes) which can be given either as rows or columns (they are automatically transformed to columns). The orthonormal matrix p is computed as follows

   p = [

where y1 is the component of y that is orthogonal to x

1 = 

If x and y are collinear y is selected along the smallest component of x. A warning message is passed unless a third argument exists (call of the form basis(x,y,1)).

p = basis([2 0 0],[1 1 1]) gives the orthonormal basis matrix p

% Generation of an orthonormal matrix
p =  basis([2 0 0],[1 1 1])

p = 
     1.0000        0        0
          0   0.7071  -0.7071
          0   0.7071   0.7071

See also

beam1, section 7.1,section 7.2
Note : the name of this function is in conflict with basis of the Financial Toolbox.

©1991-2016 by SDTools
Previous Up Next