Coordinate transform imat_fn
g=xform(f,fem)
g=xform(f,fem,csto)
g=xform(f,fem,csfrom,csto)
g=xform(f,fem,'silent')
XFORM transforms functions. It handles local->global, global->local, and local->local transformations. Transformations can occur between arbitrary coordinate systems.
F is an imat_fn to be transformed. It can be multi-dimensional and contain functions of various sizes and attributes. XFORM checks FunctionType for consistency, and warns if the abscissa or ordinate data types don't match. It processes the responses for each reference independently, and transforms based on the response nodes.
FEM is an imat_fem object containing node and coordinate system data for all of the functions to be transformed.
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 unique response nodes in F corresponding to sorted node order, a scalar, or a string. If only one coordinate system list/scalar is supplied, it is assumed to be CSTO, and CSFROM is the storage coordinate system (column 3 of fem.node.cs). If CSTO is not supplied, the coordinate system(s) to transform to is the displacement coordinate system (column 2 of fem.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.
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 returns 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.
>> 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
>>