imat_fn/xform


Purpose

Coordinate transform functions and time histories.

Syntax

g=xform(f,fem)
g=xform(f,fem,csto)
g=xform(f,fem,csfrom,csto)
g=xform(f,fem,'silent')

Description

XFORM will transform functions and time histories in the supplied imat_fn using coordinate system and node information provided in the IMAT_FEM object FEM. The imat_fn can be multi-dimensional and contain functions of various sizes. However, the functions for a given reference coordinate and response node must all be the same length. The coordinate system transformation will occur for the ordinate values at each abscissa data point. Coordinate system transformations can be local to global, global to local, or local to local. Transformations can occur between any two arbitrary coordinate systems.

CSFROM and CSTO are coordinate system labels to transform from and to, respectively. They can either be a vector of the same length as the number of nodes in the function, or a scalar. If neither is supplied, the coordinate system(s) to tranform from will be extracted from the third column (current node coordinate system) of the cs field of the node structure. The coordinate system(s) to transform to will be extracted from the second column (node displacement coordinate system) of the cs field of the node structure. If the nodes are currently in local coordinates, XFORM assumes that you want to transform back to the global. If only CSTO is supplied, the coordinate system to transform from will be extracted from the second column (node displacement coordinate system) of the cs field of the node structure. Coordinate system 0 is defined as the global Cartesian coordinate system.

Passing in the string 'silent' suppresses output to the screen.

When transforming coordinates, XFORM assumes that the function values at nodes with coordinate systems defined in cylindrical and spherical coordinate systems are actually stored in Cartesian coordinates for a Cartesian system based on the node location in the cylindrical or spherical system. As a result it only applies a Cartesian transformation. The coordinate system offsets are also not applied. For cylindrical and spherical coordinate transforms, shape coefficient transformations for nodes located at a local origin may produce inaccurate results due to numerical roundoff.

XFORM will return an imat_fn containing transformed data. The size of G may not match the size of F. For each node and reference coordinate set present in the F data, XFORM will create either 3 or 6 new functions in which to store the transformed data.

Examples

>> fem = readunv('simple_fem.unv');
>> fem.node.id        % Node labels

ans =
     100
     200
     300
     400
     500

>> 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

>> f = readadf('simple_functions.afu')

f =
10x1 IMAT Function with the following attributes:
Record Name                 OrdinateType     AbscissaSpacing  NumberElements
--------------------------- ---------------- ---------------- ----------------
1_(1X+,100X+)               Real Single      Even             2
2_(1X+,200X+)               Real Single      Even             2
3_(1X+,300X+)               Real Single      Even             2
4_(1X+,400X+)               Real Single      Even             2
5_(1X+,500X+)               Real Single      Even             2
6_(1X+,100Y+)               Real Single      Even             2
7_(1X+,200Y+)               Real Single      Even             2
8_(1X+,300Y+)               Real Single      Even             2
9_(1X+,400Y+)               Real Single      Even             2
10_(1X+,500Y+)              Real Single      Even             2

>> f.ordinate

ans =
     1     1     1     1     1     1     1     1     1     1
     1     1     1     1     1     1     1     1     1     1

>> g = xform(f,fem)
Function: Transforming GLOBAL->LOCAL

g =
15x1 IMAT Function with the following attributes:
Record Name                 OrdinateType     AbscissaSpacing  NumberElements
--------------------------- ---------------- ---------------- ----------------
1_(1X+,100X+)               Real Single      Even             2
2_(1X+,100Y+)               Real Single      Even             2
3_(1X+,100Z+)               Real Single      Even             2
4_(1X+,200X+)               Real Single      Even             2
5_(1X+,200Y+)               Real Single      Even             2
6_(1X+,200Z+)               Real Single      Even             2
7_(1X+,300X+)               Real Single      Even             2
8_(1X+,300Y+)               Real Single      Even             2
9_(1X+,300Z+)               Real Single      Even             2
10_(1X+,400X+)              Real Single      Even             2
11_(1X+,400Y+)              Real Single      Even             2
12_(1X+,400Z+)              Real Single      Even             2
13_(1X+,500X+)              Real Single      Even             2
14_(1X+,500Y+)              Real Single      Even             2
15_(1X+,500Z+)              Real Single      Even             2

>> g.ordinate

ans =
  Columns 1 through 7

    0.0670    0.8660   -1.1160    0.0670    0.8660   -1.1160    0.0670
    0.0670    0.8660   -1.1160    0.0670    0.8660   -1.1160    0.0670

  Columns 8 through 14

    0.8660   -1.1160    0.0670    0.8660   -1.1160    0.0670    0.8660
    0.8660   -1.1160    0.0670    0.8660   -1.1160    0.0670    0.8660

  Column 15

   -1.1160
   -1.1160

>> h = xform(g,fem,2,0)
Function: Transforming LOCAL->GLOBAL

h =
15x1 IMAT Function with the following attributes:
Record Name                 OrdinateType     AbscissaSpacing  NumberElements
--------------------------- ---------------- ---------------- ----------------
1_(1X+,100X+)               Real Single      Even             2
2_(1X+,100Y+)               Real Single      Even             2
3_(1X+,100Z+)               Real Single      Even             2
4_(1X+,200X+)               Real Single      Even             2
5_(1X+,200Y+)               Real Single      Even             2
6_(1X+,200Z+)               Real Single      Even             2
7_(1X+,300X+)               Real Single      Even             2
8_(1X+,300Y+)               Real Single      Even             2
9_(1X+,300Z+)               Real Single      Even             2
10_(1X+,400X+)              Real Single      Even             2
11_(1X+,400Y+)              Real Single      Even             2
12_(1X+,400Z+)              Real Single      Even             2
13_(1X+,500X+)              Real Single      Even             2
14_(1X+,500Y+)              Real Single      Even             2
15_(1X+,500Z+)              Real Single      Even             2

>> h.ordinate

ans =
  Columns 1 through 7

    1.0000    1.0000         0    1.0000    1.0000         0    1.0000
    1.0000    1.0000         0    1.0000    1.0000         0    1.0000

  Columns 8 through 14

    1.0000         0    1.0000    1.0000         0    1.0000    1.0000
    1.0000         0    1.0000    1.0000         0    1.0000    1.0000

  Column 15

         0
         0

>>

See Also

imat_shp/xform, imat_fem/xform