## 3 Simulation Analysis of the Theoretical Monitoring Model  
### Simulation and Comparison of the Magnetic Field of a Rectangular Permanent Magnet  
MATLAB was used to perform a theoretical simulation of the analytical expression for the spatial magnetic field distribution of a rectangular permanent magnet, examining the magnetic field distribution characteristics both qualitatively and quantitatively. A rectangular permanent magnet with dimensions of 40 mm (length), 10 mm (width), and 5 mm (height) was selected as the subject of this study. If the magnetic field strength at a certain height z from the center of the rectangular permanent magnet is known, and its position coordinates (a/2, b/2, z) are substituted into Equation (9), the expression for the current density can be derived as follows:  
\[J=-\frac{B_{z}\pi}{\mu  
As shown in Figure 3, the magnetic induction density \(B_{\rm z}\) exhibits a symmetric distribution at the center, which is consistent with the symmetry of the magnet's geometric shape. When the lift-off height z is relatively large, \(B_{\rm z}\) along the centerline in the x-direction initially increases and then decreases, reaching its maximum at the midpoint. For instance, at heights of 10 mm, 20 mm, and 30 mm, \(B_{\rm z}\) exhibits an \"upward convex\" distribution, with \(B_{\rm z}\) at the midpoint of the central axis being the maximum and gradually decreasing toward both ends, roughly following a quadratic curve distribution. Conversely, at smaller lift-off heights z, the \(B_{\rm z}\) near the midpoint along the central axis is lower than the values in the adjacent edge regions, gradually increasing from the midpoint outward. Near the edges, the \(B_{\rm z}\) values then decrease sharply, leading to a \"downward concave\" distribution on the surface of the permanent magnet, with the minimum \(B_{\rm z}\) at the central axis midpoint. This difference is primarily related to the distribution of magnetic field lines: within the permanent magnet, the magnetic flux is concentrated, whereas in the surrounding air, the flux is more dispersed. At the same time, the influence of edge effects results in the different \(B_{\rm z}\) distribution patterns described above. To further verify the accuracy of the analytical expression for the magnetic field distribution characteristics, we used a Tesla meter to measure the magnetic induction density \(B_{\rm z}\) of the rectangular permanent magnet, and we compared the measurements with the theoretical simulation results. The \(B_{\rm z}\) values at lift-off heights of 2 mm, 10 mm, 20 mm, and 30 mm were extracted for comparison, as shown in Figure 4.  
From Figure 4, it can be observed that the variation patterns of the magnetic induction density (\(B_{\rm z}\)) distribution curves from the theoretical simulations and experimental measurements are essentially consistent, confirming the accuracy of the analytical expression for the magnetic field distribution characteristics. However, discrepancies remain between the two analysis results, primarily due to model error and measurement error. The model error arises from the theoretical model's idealized assumptions. The theoretical model assumes that the magnetization of the magnet is uniform, but in practice, the magnet's magnetization distribution may be non-uniform. Particularly with the use and aging of the magnet, its magnetization could be influenced by temperature variations, external mechanical stresses, or material defects, causing non-uniform magnetization. Such non-uniform magnetization leads to irregularities in the magnetic field distribution, which subsequently impact the Hall sensor's measurement results. The sensor may fail to accurately detect or respond to the magnetic field generated by the magnet.