## 5 Results
### Simulation 1: Signal with 11 Harmonic Components Reduced to 5 Components  
The simulation begins with the generation of the signal, which is analysed by the proposed method. The input signal is composed of 11 spectral components, as shown in Table 2. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**No. Harmonic** & **Voltage rms (V)** & **Frequency (Hz)** & **Frequency (Rad/s)** \\ \hline
1 & 23 & 22 & 138.226 \\
2 & 230 & 49.9 & 307.870 \\
3 & 46 & 71.9 & 451.761 \\
4 & 34.5 & 122 & 766.548 \\
5 & 69 & 149.7 & 940.592 \\
6 & 23 & 171.7 & 1078.822 \\
7 & 23 & 249.5 & 1567.654 \\
8 & 23 & 271.8 & 1707.769 \\
9 & 23 & 449.1 & 2821.778 \\
10 & 23 & 471.1 & 2960.008 \\
11 & 23 & 548.9 & 3448.840 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Values of the spectral components contained in the input signal. Figure 9: Research methodology flowchart. In Figure 10, the time evolution of the input signal, consisting of the 11 spectral components, is shown over 10 fundamental cycles (200 ms) required for the calculation of the DFT [15]. In Figure 11a, the result of the DFT performed on the input signal is shown. In Figure 11b, the DFT result is displayed in greater detail to better illustrate the effects of leakage and the picket-fence effect in the DFT output. In Figure 11b, it is clearly observed how a multitude of spectral components appear in the DFT output that do not actually exist. The main objective of the method shown is to differentiate between the real components of the DFT output and those that are not, as shown in Figure 11b. The signal shown in Figure 10 and Table 2 is applied to the measurement system. The system computes the discrete Fourier transform (DFT) of the input signal and applies the algorithm described in the preceding sections. The obtained results are presented in Table 3. It is observed how the first part of the method selects 11 spectral components from the output values shown in Figure 11a. Additionally, Table 3 provides a comparison between the frequency values obtained in the selection and the actual values of the components. In the comparison, it is observed that the obtained values approximate the real values. The values obtained in Table 3 are used to construct the state transition matrix (5) of the LKF. Once the state matrix is constructed, the system initiates the LKF and the results are depicted in Figures 12 and 13. Figure 11: (**a**) Harmonic spectrum of the input signal; (**b**) detail of the harmonic spectrum. Figure 10: Input signal of the measurement system. Figure 12 shows the signal estimated by the LKF compared to the input signal. LKF starts at t = 0.3 s after the DFT and the proposed harmonic selection algorithm are completed. The evolution of the error signal is shown in Figure 13. As the LKF structure is established with the appropriate dimensions, the algorithm converges and the estimated signal matches the real signal after 300 ms, showing minimum error. This initial phase of Simulation 1 shows how the developed method calculates the number of spectral components forming the input signal. Additionally, with this information, it appropriately implements the equations constituting the Kalman filter (5-17), causing the Kalman filter output to converge to the true value (Figure 12), thereby minimizing the error between the actual and estimated signals (Figure 13). \begin{table}
\begin{tabular}{c c c c} \hline \hline \multirow{2}{*}{**No. Harmonic**} & **Voltage (Peak)** & **Frequency (Hz)** & \multirow{2}{*}{**Frequency (Hz)**} \\  & **Measured** & **Measured** & \\ \hline
1 & 14.63 & 20 & 22 \\
2 & 199.2 & 50 & 49.9 \\
3 & 29.65 & 70 & 71.9 \\
4 & 21.97 & 120 & 122 \\
5 & 59.75 & 150 & 149.7 \\
6 & 15.13 & 170 & 171.7 \\
7 & 19.9 & 250 & 249.5 \\
8 & 14.97 & 270 & 271.8 \\
9 & 19.9 & 450 & 449.1 \\
10 & 15.79 & 470 & 471.1 \\
11 & 13.93 & 550 & 548.9 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Values obtained from DFT using the proposed method. Figure 12: LKF estimated signal (red) versus input signal (blue). Figure 13: LKF estimated signal error.