Page 368 - Process Modelling and Simulation With Finite Element Methods
P. 368
A MATLAB/FEMLAB Primer for Vector Calculus 355
Vector Magnitude
The norm or magnitude of a vector is found by the formula
MATLAB will compute the norm of a vector with the formula
>> sqrt (a'*a)
ans =
3.7417
or with the built-in command norm
>> norm(a,2)
ans =
3 .I417
where sqrt ( ) is the built-in square root function.
Unit Vector
A unit vector is a vector whose norm is one. Unit vectors can be constructed by
normalization, i.e.
For example,
>> ahat=a/norm(a, 2)
ahat =
0.2673
0.5345
0.8018
The division above is scalar division, which divides each element of the vector
by the scalar.
Cross Product
The vector or cross product is defined
3
axb = lal/blsin0iz = xE,kajbk2i
i=l
where Gjk is the permutation tensor, which takes the value +1 when indices ijk
are a positive permutation of 123, -1 if they arc a negative permutation of 123,