# Optimal Design of a New Rotating Magnetic Beacon Structure Based on Halbach Array
## 2 Derivation of Halbach Array Magnetic Field Strength Formulas  
The general analytical calculation method to study the magnetic field distribution of rectangular permanent magnets is the surface current method, with basic principles based on [PERSON]'s Molecular Circulation Hypothesis. Assuming that the interior of each permanent magnet consists of several particles with charged circulation, as shown in Figure 1, then each particle can be regarded as a tiny magnet, whose sides are equivalent to the N and S poles. When the internal particles are neatly arranged, as shown in Figure 2, it shows that there is only surface current but no internal current. Therefore, the external magnetic field can be regarded as the sum of the magnetic fields generated by the surface current. The magnetization current of a uniformly magnetized dielectric is only at the surface, and the magnetic field of a permanent magnet can be regarded as generated by the magnetization current on the surface. A permanent magnet with a magnetization of M is shown in Figure 3.  
Figure 1: Charged circulating particle. Figure 3: Surface magnetic charge current. Figure 2: Schematic diagram of particle arrangement inside the magnet: (**a**) Haphazard arrangement of internal particles; (**b**) Neatly arranged internal particles. For the line current on surface ABCD, it can be regarded as the reverse of the line current on surface A'B'C'D' and is obtained by translating \(h\) along the Y-axis. Therefore, the magnetic field generated by surface ABCD can be expressed as:  
\[ \begin{array}{ll}\text{B}_{\gamma\text{x}}(\text{x},\text{y},\text{z},k)&= \text{B}_{5\text{x}}(\text{x},\text{y}+h,\text{z},-k)\\ &=\frac{-\text{i}\omega_{\text{x}}}{4\pi}[\text{sgn}(\text{z}+w/2)\times\phi( \text{s})+\text{sgn}(\text{z}-w/2)\times\phi(\text{t})]\\ \text{B}_{7\gamma}(\text{x},\text{y},\text{z},k)&=\text{B}_{5\text{x}}(\text{x},\text{y}+h,\text{z},-k)\\ &=\frac{-\text{i}\omega_{\text{x}}}{4\pi}[\text{sgn}(\text{z}+w/2)\times\eta( \text{s})+\text{sgn}(\text{z}-w/2)\times\eta(\text{t})]\end{array}  \tag{16}\]  
In Equation (16), variable symbol \(\text{s}=\left|\frac{\text{y}+h/2}{2+w/2}\right|\), \(\text{t}=\left|\frac{\text{y}+h/2}{2-w/2}\right|\), \(\theta_{7,1}=\arctan(\frac{\text{x}-l/2}{y+h/2})\), \(\theta_{7,2}=\arctan(\frac{\text{x}+l/2}{y+h/2})\). For the line current on surface BCC'B', it can be regarded as the reverse of the line current on surface ADD'A' and is obtained by translating \(w\) along the \(Z\)-axis. Therefore, the magnetic field generated by surface BCC'B' can be expressed as:  
\[ \begin{array}{ll}\text{B}_{\text{gz}}(\text{x},\text{y},\text{z},k)&=\text{B }_{6\text{z}}(\text{x},\text{y},\text{z}+w,-k)\\ &=\frac{-\text{i}\omega_{\text{x}}}{4\pi}[\text{sgn}(\text{y}+h/2)\times\eta( \text{u})+\text{sgn}(\text{y}-h/2)\times\eta(\text{v})]\\ \text{B}_{\text{gx}}(\text{x},\text{y},\text{z},k)&=\text{B}_{6\text{x}}(\text {y},\text{z}+w,-k)\\ &=\frac{-\text{i}\omega_{\text{x}}}{4\pi}[\text{sgn}(\text{y}+h/2)\times\phi( \text{u})+\text{sgn}(\text{y}-h/2)\times\phi(\text{v})]\end{array}  \tag{17}\]  
In Equation (17), variable symbol \(\text{u}=\left|\frac{\text{z}+\text{w}/2}{y+h/2}\right|\), \(\text{v}=\left|\frac{\text{z}+\text{w}/2}{y-h/2}\right|\), \(\theta_{8,1}=\arctan(\frac{\text{x}+l/2}{x+w/2})\), \(\theta_{8,2}=\arctan(\frac{\text{x}-l/2}{x+w/2})\). Equations (9)-(17) describe the distribution law of the magnetic field of a single permanent magnet. Then, seven identical permanent magnets are placed according to the Halbach array, as shown in Figure 6. The angles between the magnetization direction of each permanent magnet and the positive Y-axis are set as \(\alpha_{n}\), then the total external magnetic field is the superposition of all monomer magnetic fields. If the first permanent magnet on the left is taken as the starting point, the magnetic field produced by other permanent magnets can be regarded as the current on each surface of the first permanent magnet generated by coordinate translation and rotation.