|
1 |
| -function [F, T] = Ampere2(I2_x, I2_y, I2_z, I1_x, I1_y, I1_z, a, N, x, y, z, p1, q1, l1, p2, q2, l2, splitB, splitA) |
| 1 | +function [F, T] = Ampere2(I2_x, I2_y, I2_z, I1_x, I1_y, I1_z, a, N, x, y, z, quat1, quat2, splitB, splitA) |
2 | 2 | %原点にあるN巻き,半径a,電流Iのコイルによって,(x, y, z)にあるN巻き,半径a,電流I_x, I_y, I_zのコイルに発生するアンペール力(力,トルク)
|
3 | 3 | % Detailed explanation goes here
|
4 | 4 |
|
|
8 | 8 | phi = 0;
|
9 | 9 | F = [0, 0, 0];
|
10 | 10 | T = [0, 0, 0];
|
11 |
| -quat = quaternion([p2,q2,l2],'euler','XYZ','point'); |
12 | 11 |
|
13 | 12 |
|
14 | 13 | %z coil
|
15 | 14 | while i < splitA
|
16 | 15 |
|
17 | 16 | i = i + 1;
|
18 | 17 | phi = phi + d_phi;
|
19 |
| - rot_point_z = rotatepoint(quat, [a * cos(phi), a * sin(phi), 0]); |
20 |
| - B = magnetic_flux_three_coil(rot_point_z(1) + x, rot_point_z(2) + y, rot_point_z(3) + z, I1_x, I1_y, I1_z, a, N, p1, q1, l1, splitB); |
| 18 | + rot_point_z = rotatepoint(quat2, [a * cos(phi), a * sin(phi), 0]); |
| 19 | + B = magnetic_flux_three_coil(rot_point_z(1) + x, rot_point_z(2) + y, rot_point_z(3) + z, I1_x, I1_y, I1_z, a, N, quat1, splitB); |
21 | 20 | %disp(norm(B))
|
22 |
| - d_I = I2_z * N * rotatepoint(quat, [-sin(phi), cos(phi), 0]) * d_phi; |
| 21 | + d_I = I2_z * N * rotatepoint(quat2, a * [-sin(phi), cos(phi), 0]) * d_phi; |
23 | 22 | %disp(I2_z)
|
24 | 23 | %disp(B)
|
25 | 24 | d_F = cross(d_I, B);
|
26 | 25 | %d_F = Ampere(I, phi, B);
|
27 |
| - d_T = cross(rotatepoint(quat, [a*cos(phi), a*sin(phi), 0]), d_F); |
| 26 | + d_T = cross(rotatepoint(quat2, [a*cos(phi), a*sin(phi), 0]), d_F); |
28 | 27 | %disp(d_B)
|
29 | 28 | F = F + d_F;
|
30 | 29 | T = T + d_T;
|
|
37 | 36 |
|
38 | 37 | i = i + 1;
|
39 | 38 | phi = phi + d_phi;
|
40 |
| - rot_point_y = rotatepoint(quat, [a * sin(phi), 0, a * cos(phi)]); |
41 |
| - B = magnetic_flux_three_coil(rot_point_y(1) + x, rot_point_y(2) + y, rot_point_y(3) + z, I1_x, I1_y, I1_z, a, N, p1, q1, l1, splitB); |
42 |
| - d_I = I2_y * N* rotatepoint(quat, [cos(phi), 0, -sin(phi)] )* d_phi; |
| 39 | + rot_point_y = rotatepoint(quat2, [a * sin(phi), 0, a * cos(phi)]); |
| 40 | + B = magnetic_flux_three_coil(rot_point_y(1) + x, rot_point_y(2) + y, rot_point_y(3) + z, I1_x, I1_y, I1_z, a, N, quat1, splitB); |
| 41 | + d_I = I2_y * N* rotatepoint(quat2, a * [cos(phi), 0, -sin(phi)] )* d_phi; |
43 | 42 |
|
44 | 43 | d_F = cross(d_I, B);
|
45 | 44 | %d_F = Ampere(I, phi, B);
|
46 |
| - d_T = cross(rotatepoint(quat, [a*sin(phi), 0, a*cos(phi)]), d_F); |
| 45 | + d_T = cross(rotatepoint(quat2, [a*sin(phi), 0, a*cos(phi)]), d_F); |
47 | 46 | %disp(d_B)
|
48 | 47 | F = F + d_F;
|
49 | 48 | T = T + d_T;
|
|
58 | 57 |
|
59 | 58 | i = i + 1;
|
60 | 59 | phi = phi + d_phi;
|
61 |
| - rot_point_x = rotatepoint(quat, [0, a * cos(phi), a * sin(phi)]); |
62 |
| - B = magnetic_flux_three_coil(rot_point_x(1) + x, rot_point_x(2) + y, rot_point_x(3) + z, I1_x, I1_y, I1_z, a, N, p1, q1, l1, splitB); |
63 |
| - d_I = I2_x * N* rotatepoint(quat, [0, -sin(phi), cos(phi)]) * d_phi; |
| 60 | + rot_point_x = rotatepoint(quat2, [0, a * cos(phi), a * sin(phi)]); |
| 61 | + B = magnetic_flux_three_coil(rot_point_x(1) + x, rot_point_x(2) + y, rot_point_x(3) + z, I1_x, I1_y, I1_z, a, N, quat1, splitB); |
| 62 | + d_I = I2_x * N* rotatepoint(quat2, a * [0, -sin(phi), cos(phi)]) * d_phi; |
64 | 63 | %d_I = I2_x * N* [0, -sin(phi), cos(phi)] * d_phi;
|
65 | 64 | d_F = cross(d_I, B);
|
66 | 65 | %d_F = Ampere(I, phi, B);
|
67 | 66 | %disp(d_F)
|
68 |
| - d_T = cross(rotatepoint(quat, [0, a*cos(phi), a*sin(phi)]), d_F); |
| 67 | + d_T = cross(rotatepoint(quat2, [0, a*cos(phi), a*sin(phi)]), d_F); |
69 | 68 | %disp(d_B)
|
70 | 69 | F = F + d_F;
|
71 | 70 | %disp("d_F is")
|
|
0 commit comments