# 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.1 Feasibility Verification and Convergence Speed Analysis  
In order to verify the proposed scheme's feasibility, simulation experiments were performed first. The LMSED algorithm was verified using the MATLAB software platform. In the simulation, the frequency of the input angle is \(f_{c}=0.05\) Hz and the sample frequency is 250 Hz. The simulation model used to generate simulation data is based on Equation (21):  
\[ \begin{split} U(k)&=0.6079\cdot\sin(2\pi\cdot f_{c} \cdot k+0.0876)+0.1336,\\ V(k)&=0.6228\cdot\cos(2\pi\cdot f_{c}\cdot k+0.0876+0.0 629)+0.1831.\end{split}  \tag{21}\]  
Figure 6 shows the waveform of the simulation signal and the Lissajous figure. For the LMSED algorithm, the step factor of signal \(U\) is set to \(W_{1}=0.0003\cdot\left(1,1,1\right)^{T}\) and that of signal \(V\) is set to \(W_{2}=0.0001\cdot\left(5,3,1\right)^{T}\). For the demodulation process, the curve of the parameters, the error curve, and the calibrated signals are shown in Figure 7.  
Figure 6: Simulation signals: (**a**) Lissajous figure; (**b**) waveform of the signals in which the blue curve indicates the sine signal and the red curve indicates the cosine curve. Figure 7: _Cont._
Parameter demodulation results are summarized in Table 1.  
Figure 7: Demodulation details. (**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\); (**g**) change process of calculated error; (**h**) waveform of the calibrated signals in which the blue and red curve indicates the sine and cosine signal, respectively. Additionally, the angular calculation errors with and without calibration are shown in Figure 8.  
The maximum value of the angular error without and with parameter calibration is 30.38\({}^{\circ}\) and \(9.52\times 10^{-4\circ}\), respectively. The error reduces to 0.003% after calibration. The results show that the proposed algorithm can accurately calculate the signal component amplitude and also verify the accuracy of the angle calculation module. When the parameter demodulation values are stable within \(1\pm 1\%\) of the preset values, the steady-state of convergence is reached. Thus, the time when all parameters satisfy this requirement for the first time is defined as the convergence time. In the simulation results, the convergence time is approximately 195.70 s. Based on the iterative formula of the parameters, it can be inferred that sampling frequency, angular frequency, and step factor all have an influence on convergence speed and accuracy. This effect cannot be characterized by a simple function. To control a single variable, more simulation experiments are performed and better optimization parameters and faster convergence speed are obtained. Results are summarized in Table 2. This process is an attempt to continuously change parameters near the initial value. In the experiment, we tried the frequency parameter from 0 to 1000 Hz, and the step factor ranged from \(1\times 10^{-6}\) to 1. \begin{table}
\begin{tabular}{c c c} \hline
**Parameters** & **Preset Values** & **Identification Values** \\ \hline \(a_{1}\) & 0.6079 & 0.6079 \\ \(a_{2}\) & 0.6228 & 0.6228 \\ \(b_{1}\) & 0.1336 & 0.1336 \\ \(b_{2}\) & 0.1831 & 0.1831 \\ \(\beta\) & 0.0629 & 0.0629 \\ \(\varphi\) & 0.0876 & 0.0876 \\ \hline \end{tabular}
\end{table} 
Table 1: Parameter identification results for the simulation. Figure 8: Angular error obtained from the simulation: (**a**) comparison of angular errors with and without parameter calibration; (**b**) magnified display of the curve of angular error with parameter calibration in (**a**). According to the simulation results, the step factor has a greater impact on convergence speed, as properly increasing the step factor speeds up convergence.