# Simplified Welch Algorithm for Spectrum Monitoring
## 3 Modified Welch Algorithm
### Theoretical Analysis  
The following analysis explains the equivalency between weighted averaging with the \(\alpha\) parameter and arithmetic averaging with \(N\) order based on the Signal to Noise Ratio (\(SNR\)) enhancement. \(SNR\) is defined as:  
\[SNR=\frac{P_{S}}{P_{Z}} \tag{14}\]  
where \(P_{S}\) and \(P_{Z}\) are the input signal and the white Gaussian noise power respectively. Reference [24] explains the effect of signal averaging on a steady signal \(S\) with an associated noise variance of \(\sigma^{2}\). It is proven that if observed signals in averaging iteration are correlated, after \(N\) time averaging, \(SNR_{Averaging}\) is improved by factor of \(N\):  
\[ \begin{array}{l}SNR_{Averaging}=N\cdot SNR\\ SNR_{Averaging}[\text{dB}]=10 log_{10}^{N}+SNR[\text{dB}]\end{array}  \tag{15}\]  
Following the same way as [24], it can be proven that for weighted averaging \(SNR_{Averaging}^{weighted}\) is improved by factor \(\frac{1}{1-a}\):  
\[ \begin{array}{l}SNR_{Averaging}^{Weighted}=\frac{1}{1-a}\cdot SNR\\ SNR_{Averaging}^{Weighted}[\text{dB}]=10 log_{10}^{(\frac{1}{1-a})}+SNR[\text{ dB}]\end{array}  \tag{16}\]  
Figure 2: General block diagram of modified design of Welch algorithm implementation. For better understanding, the same scenario has been simulated. First, a discrete signal with 1000 samples is generated and white Gaussian noise with \(SNR\) = 15 dB is added to the desired signal. Then, the system tries to increase the SNR with the help of two different averaging types. Figure 3c displays \(SNR_{Averaging}\) versus order \(N\). Clearly, more \(SNR_{Averaging}\) improvement is obtained by increasing the \(N\) order. In another figure, the output \(SNR_{Averaging}\) after weighted averaging with different \(\alpha\) parameter is displayed. It can be seen weighted averaging with \(\alpha\) = 0.99 improve \(SNR\) by the gain around 20 dB. These two figures allow the user to see which \(\alpha\) parameter in weighted averaging is equivalent to which \(N\) order in normal averaging. Based on this comparison, \(\alpha\) = 0.99 is equivalent to normal averaging with order \(N\) = 100. This comparison allows the user to select the \(\alpha\) parameter based on two new criteria:  
* Desired \(SNR\) improvement for system
* Equivalent average ordering \(N\) in normal Welch algorithm  
The parameters selected for the weighted averaging directly affects the behavior of the system in two ways:  
Figure 3: A discrete signal (**a**) without noise (**b**) with noise Signal to Noise Ratio (\(SNR\)) = 15 dB. (**c**) \(SNR\) improvement after arithmetic averaging versus order \(N\). (**d**) \(SNR\) improvement after weighted averaging versus \(\alpha\) parameter. 1. Convergence time: At first, it seems that the sorted values inside the RAM will grow to an unlimited value. However, because \(\alpha\) is smaller than one, the sorted values (Welch spectrum) grow to a certain value and after that the system will converge to a final spectrum. A larger \(\alpha\) needs more convergence time and generates larger sorted values in the RAM. Thus, if the system is monitoring data with fast variations, smaller values should be used to enable faster tracking. Another important point here is the hardware limitation for saving the large values inside the RAM. If the saved values are larger than the computational capability of system, a saturation error will happen. 2. Obtained spectrum shape: The \(\alpha\) determines the dependency of the obtained spectrum to the past. A larger \(\alpha\) means more averaging over the past FFT samples. As a result, the spectrum obtained from a larger \(\alpha\) is smoother with the less noise. To better understand the difference between the original Welch method [7] and this modified method, the frequency response of a running average is compared to the weighted averaging. Running average has the following frequency response:  
\[H(z)=\frac{1}{N}\sum_{i=0}^{N}z^{-i} \tag{17}\]  
Figure 4 presents frequency response of the arithmetic average with different order \(N\).