# Optimal Design of a New Rotating Magnetic Beacon Structure Based on Halbach Array
## 5 Simulation Experiment Verification  
COMSOL physics simulation software is based on mathematical models to derive and represent the laws of physics, and the main way of working is to discretize the whole analysis, namely finite element analysis (FEA). By inputting the dimensional parameters of the permanent magnet, the direction and size of the magnetic flux, and the parameters of the environmental medium, an infinitely close model of the real permanent magnet can be simulated. In this paper, a structure that can generate signals that meet the requirements of phase-type angle measurement was obtained through MALAB modeling optimization, and then the structural parameters were input into the COMSOL physical simulation software to obtain the model as shown in Figure 19. The material used in this model is NdFeB (N50), the residual flux density Br is 1.4 T, and the mesh size needs to be set before the simulation of magnetic field; the maximum mesh size is set as 0.1 cm. After the simulation, we can obtain the magnetic flux distribution of the optimized structure, as shown in Figure 20.  
To further verify the optimized structure, the magnetic field intensity on both sides of the array is collected to get the magnetic field intensity variation curve with measurement points: from P\({}_{13}\) (\(-8\), \(-6\), \(0\)) to P\({}_{14}\) (\(8\), \(-6\), \(0\)); from P\({}_{15}\) (\(-8\), \(6\), \(0\)) to P\({}_{16}\) (\(8\), \(6\), \(0\)). Meanwhile, the same measurement points are set in the mathematical model of the structure, so the comparative data plot of the mathematical modeling and simulation model can be obtained, as shown in Figure 21. The error analysis of both is shown in Figure 22.  
Figure 19: Structural diagram modeled by COMSOL physical simulation software.  
Figure 20: Magnetic flux distribution of the optimized structure.  
From Figure 21, it can be seen that the magnetic field strength generated by the magnetic array simulated with COMSOL physical simulation software is slightly smaller than that generated by the structure modeled with MATLAB software, and the error between the two can be controlled in the range of 0.0008 T-0.00115 T. Through analysis, the main reasons for the error may be the following: (1) the permanent magnet model derived from the mathematical equation is completely idealized, and not much consideration is given to the influence of the environment, while the simulation using COMSOL physics simulation software needs to consider the magnetic properties of the material of the permanent magnet, the environment in which it is located, and is not completely idealized, so there are differences in the data between the two; (2) COMSOL physical simulation software for permanent magnets is based on the principle of finite element analysis, which is essentially a partitioning of the structure. Since each cell is not infinitely small, there is an error in the analysis of the small cells compared with the derivation of the formula, so there is an error accumulation in the analysis of the whole array. However, in general, the difference between the two is very small, and it can be considered that the array structure obtained by the optimization adjustment in this paper has very good usability.