Page 369 - Process Modelling and Simulation With Finite Element Methods
P. 369
356 Process Modelling and Simulation with Finite Element Methods
and zero otherwise. fi is the unit normal vector to the plane containing a and b.
zf is the unit vector in the i-th coordinate direction.
MATLAB provides a special function to compute cross products
>> help cross
CROSS Vector cross product.
C = CROSS(A,B) returns the cross product of the vectors
A and B. That is, C = A x B. A and B must be 3 element
vectors.
C = CROSS(A,B) returns the cross product of A and B along the
first dimension of length 3.
C = CROSS(A,B,DIM), where A and B are N-D arrays, returns the cross
product of vectors in the dimension DIM of A and B. A and B must
have the same size, and both SIZE(A,DIM) and SIZE(B,DIM) must be 3.
See also DOT.
For example,
>> cross (a,b)
ans =
-8
-8
8
>> cross (b, a)
ans =
8
8
-8
We see that the order of factors in a cross product switches the sign of the cross
product, akin to changing the sense of the unit normal fi .
A.2 Arrays: Simple Arrays, Cell Arrays, and Structures
Array manipulation is essential to data extraction from FEMLAB. FEMLAB has
organized models conveniently (for its developers and programmers) around fem
structures for multiphysics and xfem structures for extended multiphysics.
Pruning structures and cell arrays to extract meaningful information is a useful
way of interrogating FEMLAB models (and solutions).
Simple Arrays
Arrays have dimensions (mx nx 1 ...). A matrix is a two-dimensional array.
Each dimension has a length. So two very important commands are size ( )
and length ) .
(