-
Notifications
You must be signed in to change notification settings - Fork 1
/
unit3d.m
61 lines (55 loc) · 2.16 KB
/
unit3d.m
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
function [Bxt,Byt,Bzt] = unit3d(a1,a2,b1,b2,c1,c2,t,x,y,z)
% Evaluation of the integral of the Biot-Savart law
% for the Bx,By,Bz component of induced field. The
% a1,a2,b1,b2,c1,c2 are geomterical factors as defined
% in the equation S2.
Bzt = (...
((a2*b1-b1*x+a1*(-b2+y))* ...
(a1^2*t+b1^2*t+a1*(a2-x)+b1*(b2-y) ...
+c1*(c2+c1*t-z))) ...
) ...
/ ( ...
sqrt(a2^2+b2^2+c2^2+2*a1*a2*t+2*b1*b2*t ...
+2*c1*c2*t+a1^2*t^2+b1^2*t^2+c1^2*t^2-2*a2*x ...
-2*a1*t*x+x^2-2*b2*y-2*b1*t*y+y^2-2*c2*z-2*c1*t*z+z^2) ...
*(b2^2*c1^2+a2^2*(b1^2+c1^2)-2*b1*b2*c1*c2+b1^2*c2^2 ...
+b1^2*x^2+c1^2*x^2-2*b2*c1^2*y+2*b1*c1*c2*y ...
+c1^2*y^2+2*a1*x*(b1*(b2-y)+c1*(c2-z)) ...
-2*a2*((b1^2+c1^2)*x+a1*b1*(b2-y)+a1*c1*(c2-z)) ...
+2*b1*b2*c1*z-2*b1^2*c2*z-2*b1*c1*y*z+b1^2*z^2 ...
+a1^2*(b2^2+c2^2-2*b2*y+y^2-2*c2*z+z^2)) ...
);
Byt = (...
((-a2*c1+c1*x+a1*(c2-z))*...
(a1^2*t+b1^2*t+a1*(a2-x)+b1*(b2-y) ...
+c1*(c2+c1*t-z)))...
) ...
/ ( ...
sqrt(a2^2+b2^2+c2^2+2*a1*a2*t+2*b1*b2*t ...
+2*c1*c2*t+a1^2*t^2+b1^2*t^2+c1^2*t^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