# Design and Implementation of a System-on-Chip for Self-Calibration of an Angular Position Sensor
## 4 Simulation and Experimental Results
### LMSED Algorithm Simulation
#### 4.1.2 Analysis of the Effect of Influencing Factors on Demodulation and Calibration Results  
In the section above, the ideal signal model is used and the exact parameter values are obtained, and the error after calibration is almost zero. This section describes the effect of the influencing factors on the calibration effect, including noise and the non-constant rotational speed. For noise analysis, Gaussian noise with a mean of 0 and a variance of 1 is added to the two signals. The maximum value of the absolute value of the noise is defined as the noise peak, and the influence of the noise peak on the parameter solution and the angle calibration is analyzed. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Variable/Hz** & **Better Value** & **Convergence Time (s)** & **Other Parameter** \\ \hline Sampling frequency \(f_{\mathrm{s}}\) & 325 & 148.80 & \(f_{\mathrm{c}}=0.05\) \\ Angular frequency \(f_{\mathrm{c}}\) & 100 & 122.50 & \(f_{\mathrm{s}}=250\) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Better variable values with an unchanged step factor in the simulation. Figure 9: Convergence details under better step factors. (**a**) Change process of \(a_{1}\); (**b**) change process of \(a_{2}\); (**c**) change process of \(b_{1}\); (**d**) change process of \(b_{2}\); (**e**) change process of \(\varphi\); (**f**) change process of \(\beta\). The simulation signal is described in Equation (21). The input angle and sample frequency is 0.05 and 250 Hz. The range of noise peaks is chosen to be \(10^{n}(n=-2,-3,\ldots-6)\) times the amplitude of the simulated signal. \(n\) is defined as the noise scale factor. The results when simulation time is 400 s are summarized in Table 3.  
The preset values of \(a_{1}\), \(a_{2}\), \(b_{1}\), \(b_{2}\), \(\beta\), \(\varphi\) are 0.6079, 0.6228, 0.1336, 0.1831, 0.0629, 0.0876, respectively. When four decimal places are reserved, the solution result is the same as the set value. For further analysis, the angular position error results with and without calibration are summarized in Table 4, with different noise peak values. From the simulation results, the existence of noise has little effect on the parameter demodulation, which is related to the characteristics of the demodulation algorithm looking for the average error. The proposed solution does not eliminate signal noise, so the presence of noise affects the accuracy of the calculation of the angle. For non-constant rotational speed analysis, speed disturbance with a mean of 0 and a variance of 1 is added to the two signals. The simulation signals have expressions described in Equation (22). The range of noise peaks is chosen to be \(10^{m}(m=-2,-3,-4)\) times the value of the simulated frequency. \(m\) is defined as the scale factor. The simulation results are summarized in Tables 5 and 6. \[ \begin{array}{l}U(k)=0.6079\cdot\sin((2\pi\cdot f_{c}+\mu(k))\cdot k+0.0876)+ 0.1336,\\ V(k)=0.6228\cdot\cos((2\pi\cdot f_{c}+\
u(k))\cdot k+0.0876+0.0629)+0.1831. \end{array}  \tag{22}\]  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Noise Scale Factor (\(n\))** & \begin{tabular}{c} **Maximum Value of the Absolute** \\ **Error without Calibration** \\ \end{tabular}  & \ \begin{tabular}{c} **Maximum Value of the** \\ **Angular Error with Calibration** \\ \end{tabular}  & \begin{tabular}{c} **Error Reduction** \\ **Ratio** \\ \end{tabular}  \\ \hline \(-2\) & 30.78\({}^{\circ}\) & 0.60\({}^{\circ}\) & 1.95\% \\ \(-3\) & 30.42\({}^{\circ}\) & 0.06\({}^{\circ}\) & 0.20\% \\ \(-4\) & 30.39\({}^{\circ}\) & 0.06\({}^{\circ}\) &  
From the simulation results, the disturbance of speed has a great influence on the parameter demodulation. Taking \(U(k)\) as an example, it can be concluded from Equation (23) that the fluctuation of velocity is equivalent to adding an error component to both the amplitude and the DC offset. When the sampling time is large enough, the amplitude component will have a large change, and the excessive change will invalidate the algorithm. \[