blob: 075ea584970b0c4c8fa0be17eda6f7c976228893 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
//clear//
//Caption:Transform the vector of Rectangular coordinates into spherical coordinates
//Example1.4
//page 22
clc;
y = sym('y');
x = sym('x');
z = sym('z');
ax = sym('ax');
ay = sym('ay');
az = sym('az');
ar = sym('ar');
aTh = sym('aTh');
aphi = sym('aphi');
G = (x*z/y)*ax;
disp(G,'Given vector in cartesian co-ordiante system B=')
r = sym('r');
teta = sym('teta')
phi = sym('phi')
x1 = r*sin(teta)*cos(phi);
y1 = r*sin(teta)*sin(phi);
z1 = r*cos(teta);
G1 = (x1*z1/y1)*ax;
Gr = G1*ar;
GTh = G1*aTh;
Gphi = G1*aphi;
Gsph = [Gr,GTh,Gphi];
disp(Gr,'Gr=')
disp(GTh,'GTh=')
disp(Gphi,'Gphi=')
//Result
//Given vector in cartesian co-ordiante system B = ax*x*z/y
//Gr = ar*ax*cos(phi)*r*cos(teta)/sin(phi)
//GTh = ax*cos(phi)*r*cos(teta)*aTh/sin(phi)
//Gphi = aphi*ax*cos(phi)*r*cos(teta)/sin(phi)
//
|