Coordinate transform node coordinates.
fem2=xform(fem)
fem2=xform(fem,csto)
fem2=xform(fem,csfrom,csto)
fem2=xform(fem,'silent')
XFORM transforms node coordinates. It handles local->global, global->local, and local->local transformations. Transformations can occur between arbitrary coordinate systems.
FEM is an IMAT_FEM object containing node and coordinate system data for all of the nodes to be transformed. It can either be a single IMAT_FEM containing at least nodes and coordinate systems, or it can be separate IMAT_NODE and IMAT_CS objects. Transformation can occur between two arbitrary coordinate systems.
CSFROM and CSTO are coordinate system labels to transform from and to, respectively. They can be a vector of the same length as the number of nodes, a scalar, or a string. If neither is supplied, XFORM transforms from the storage coordinate system (column 3 of node.cs) to the definition system (column 1 of node.cs). If only one coordinate system list/scalar is supplied, it is assumed to be CSTO, and CSFROM is set to the storage coordinate system (column 3 of .node.cs). Coordinate system 0 is defined as the global Cartesian (basic) coordinate system.
Passing in strings for CSFROM and CSTO is a shorthand way of specifying the column of node.cs from which to extract the coordinate systems. Strings starting with 's' specify the storage coordinate system (column 3), 'd' specifies the displacement coordinate system (column 2), and 'r' specifies the reference or definition system (column 1).
Passing in the string 'silent' suppresses output to the screen.
XFORM assumes that the angular coordinates for nodes defined in cylindrical or spherical systems are in radians. For cylindrical and spherical coordinate transforms, nodes located at a local origin may produce inaccurate results due to numerical roundoff.
If the input is an IMAT_FEM, the output will be an IMAT_FEM containing the input model data with transformed node coordinates. If the input is an IMAT_NODE and IMAT_CS, the output will be an IMAT_NODE.
>> fem = readunv('simple_fem.unv');
>> fem.node.coord % Nodal coordinates
ans =
0 0 0
1 0 0
0 1 0
0 0 1
1 1 1
>> fem.node.cs % Nodal coordinate system definitions
ans =
2 2 0
2 2 0
2 2 0
2 2 0
2 2 0
>> fem.cs.matrix(:,:,2) % Transformation matrix for CS 2
ans =
0.5000 -0.4330 0.7500
0 0.8660 0.5000
-0.8660 -0.2500 0.4330
1.0000 2.0000 3.0000
>> fem2 = xform(fem);
Nodes: Transforming GLOBAL->LOCAL
>> fem2.node.coord
ans =
-1.8840 -3.2321 0.0670
-1.3840 -3.2321 -0.7990
-2.3170 -2.3660 -0.1830
-1.1340 -2.7321 0.5000
-1.0670 -1.8660 -0.6160
>> fem3 = xform(fem2,2,0);
Nodes: Transforming LOCAL->GLOBAL
>> fem3.node.coord
ans =
0 0 0
1.0000 0 0
0 1.0000 0
0 0 1.0000
1.0000 1.0000 1.0000
>>