## 5 Results
### Simulation 1: Signal with 11 Harmonic Components Reduced to 5 Components
Figure 16 shows the error between the real signal and the estimation made by the LKF. It is observed that in moments prior to the change in the value of the input signal, this variation is practically non-existent, while once the change occurs, the error increases. This variation in the error signal value causes the method to restart, reacquiring the data for the calculation of the DFT (Figure 8). Figures 17-19 depict the evolution of some of the estimations made for the spectral components in the period between t = 0.75 and t = 1 s. During this period, the estimations are made with the number of states prior to the change in the input signal. Figures 17-19 show the evolution of the estimation (red) of three out of the five spectral components composing the input signal. It is shown how the estimation is erroneous, and the obtained result is invalid for the application. These errors occur because the LKF attempts to minimize the error (Figures 15 and 16) between the input signal and the total estimation of the model, thereby modifying the values of all the internal variables it possesses. In this case, it is observed how spectral components that do not exist in the real signal (Figure 19, blue) are assigned an estimated value to minimize the error between the estimation value and the real signal (Figure 19, red). These results confirm that when there is a change in the number of spectral components composing a signal, a new set of equations must be implemented to account for the actual number of spectral components [34]. Otherwise, as demonstrated, it may result in the estimation of the overall signal, which, when compared with the input signal, has minimal error, but the estimations of the variables are far from their real values. The proposed algorithm is applied again at the end of the DFT at t = 1 s, and the output values are reassessed by the method to determine which values are real and which are the result of the undesired effects of the DFT (Figure 5, Section 4). In the next stage, the equations of the LKF (5-17) are rewritten, adapting the Kalman filter to the actual components of the input signal so that they only contain equations corresponding to the true spectral components. The simulation continues, and the new LKF performs the estimation of the different spectral components. In Figure 20, the evolution of the estimation made with the LKF (red) and the actual input signal (blue) is shown. It can be observed how the difference between them decreases as the simulation progresses until it is minimized. In Figure 21, the evolution of the error is shown. Figure 19: Evolution of the estimation of the spectral component at 449.1 Hz (red) and the real component (blue). Figure 20: Estimation of the LKF signal (red) versus input signal during the change in the number of spectral components (blue). In Figure 21, it can be observed how the error occurs between the estimation made with the LKF using the new equations implemented after estimating the number of spectral components and the actual input signal. It shows how the error minimizes over the course of the simulation and reaches a minimum (less than 0.1% of the maximum value of the main harmonic) after 260 ms from the beginning of the new estimation. A detail of the estimation error is shown in Figure 22.  
Figure 22 illustrates the evolution of the estimation of the 22 Hz spectral component. It shows from t = 0.95 s, moments prior to the start of the estimation with the new variables of the LKF, but still with the variables for the previous 11 spectral component signals. It demonstrates how the estimation, after implementing new equations of the LKF according to the results provided by the method (Table 4), tends to converge to the value of the real signal. Figure 24 shows the convergence of the estimation of the frequency value for all the harmonic components composing the input signal. The convergence of the frequency measures the time it takes to occur. For this harmonic component (22 Hz), the LKF requires about 400 ms.