Professional Documents
Culture Documents
Matlab 4
Coordinate systems
A or A or A
scalar
A Ax a x Ay a y Az a z
Example
A = 1ax + 2ay + 3az
>> A = [1 2 3]
Find the magnitude of A
>> norm(A)
or >> abs(A)
Scalar product
AB = |A||B|cos = ABcos
Equivalent definition
AB = AxBx +AyBy +AzBz
Scalar projection
A B
projB A
B
example_101
Cross product
A x B = |A||B|sin = ABsin
Equivalent definition
a x
A B Ax
Bx
a y
a z
Ay
Az
By
Bz
Ay Bz Az By a x Az Bx Ax Bz a y Ax By Ay Bx a z
example_102
The cross product of the two vectors A = 2ax + 1ay + 0az and B = 1ax + 2ay + 0az is
shown. The vector product of the two vectors A and B is equal to C = 0ax + 0ay + 3az.
A (B x C)=B (C x A) = C (A x B)
>> dot(A, cross(B,C))
A x (B x C)=B(A C) -C(A B)
>> cross(A, cross(B,C))
A = [3 0 0];
B = [0 2 0];
C = [0 2 4];
deltav = C(A x B)
example_103
A A a A a Az a z
orthogonal point (, , z)
= a radial distance (m)
= the angle measured from
x axis to the projection of the
radial line onto x-y plane
z = a distance z (m)
a z
a x
cos
-sin
a y
sin
cos
a z
x2 y 2
A conversion from
P(,, z) to P(x,y,z)
x cos
y
tan
x
y sin
zz
zz
Matlab command
[ph,rh,z] = cart2pol(x,y,z)
Matlab command
[x,y,z] = pol2cart(ph,rh,z)
figure_112
1
0.8
0.6
0.4
0.2
0
2
1
2
1
-1
-1
-2
-2
A Ar a r A a A a
figure_113
a x
sincos
coscos
-sin
a y
sinsin
cossin
cos
cos
-sin
a z
z
cos
r
1
y
tan
x
A conversion from
P(r,, ) to P(x,y,z)
x r sin cos
y r sin sin
z r cos
Matlab command
Matlab command
[th,phi,r] = cart2sph(x,y,z) [x,y,z] = sph2cart(th,phi,r)