# Why averaging in Spectral magnitude domain not in complex domain to estimate spectrum of a process

Consider we need the magnitude spectrum of the signal. Signal is recorded in $N$ trials to a certain stimuli. Signal varies from each trial because of noise. So, to estimate the actual magnitude spectrum, there are two approaches:

1. Avg. in temporal domain: Average out trials in temporal domain to obtain signal of less noise and then take its fourier transform to obtain signal's complex frequency content. Visualize magnitude spectrum. The output would be the same, even if we average the fourier transforms(complex), as it is a linear operator.
2. Avg. in magnitude spectrum domain: Compute fourier transforms of each trial, get magnitude spectrum and average this across trials.

According to me, approach (1) is correct as we are not neglecting any of it. Averaging has to be done in linear domain, which is real and imaginary parts of the complex output (Fourier transform). Whereas the second approach neglects phase spectrum of each trial, i.e. averaging in Polar representation of complex number individually. Many of my friends, even a professor approve the second approach (2). Their argument is that, because the requirement is the magnitude spectrum which is random, because of noise in each trial, so averaging the required output (Fourier transform) over many trials to obtain its estimate is a reasonable step. I am not convinced with it, as spectrum consists of both phase and magnitude and just neglecting one of it to get an estimate individually, by linear approaches, (here Arithmetic mean) is not proper, as the true underlying magnitude spectrum, getting modulated by noise, may be some form of non-linearity (function mapping temporal signal to magnitude spectrum). Thus, averaging magnitude spectrum out won't null out the noise. So, please help by providing opinions of what may be correct and why ?

You seem to understand the issues at hand. In your situation, if the trial runs would be identical, except for the noise, averaging the signals (or the complex values) will definitely work, and I recommend that it how you do it.

The notion of averaging magnitudes (or magnitudes squared) across DFTs comes from when you are chunking a signal into multiple DFTs and want to aggregate the results. In that case, if you average the raw DFTs you will get all sorts of cancellation/reinforcement effects depending on the frequency values of the signal compared to your DFT frame length. When you average the magnitudes, the phase values are ignored and you will get more desirable results.

As is often the case wiht policy, it sometimes gets followed blindly without the understanding of the rationale behind the policy. That may be what is behind some of the recommendations you have heard.

If you are trying to decompose your signal (assuming it is periodic) into its constituent harmonics, retaining the phase information is essential.

Hope this helps,

Ced

Care must be taken when using the words signal, process, and spectrum. The words expected value and average also require care. Signal Processing Algorithms are based on assumed signal models and noise models (and often interference models). One typically formulates a probabilistic model because at a minimum, noise is present. One may go as far as saying that without noise why would you process signals. Noise in itself is an interesting topic, in part because there are alternative interpretations which are not mutually exclusive as are signals.

The central question rests on what the term "random" means. The book by One interpretation is that a physical thermodynamic process is random. Another interpretation is that random is a kind of uncertainty. Both of these interpretations satisfy Kolmogorov's axioms of probability.

See: Leonard J. Savage The Foundations of Statistics,Dover Books on Mathematics, 1972

and Edwin Thompson Jaynes Probability Theory: The Logic of Science

The point of this lengthy digression is that there are many ways to mathematically formulate a signal-noise-interference model. Given some criteria, often called optimal, such as a likelihood function, a Signal Processing Algorithm is formulated.

There are also models where the optimal solution is intractable. An example is the optimal solution requires an exhaustive combinatorial enumeration of a large number of parameters. So Signal Processing Algorithms also can be heuristic.

There are models (and heuristics) where you complex average and models where complex averaging is neither optimal or heuristically justified and the solution from the wrong model just adds random phases and there is no coherent gain and very often a loss. The model defines the appropriate operations performed on the the data, often just called the signal.

Complex averaging of repeated copies of the same signal is possible but the DFT’s need to be precisely synchronized to the signals and this can be hard to do because avoiding jitter between discrete time sample points of actual sampled analog signals takes a great deal of effort. Some jitter can be tolerated but the amount depends on the application.

Averaging magnitudes or magnitude squared averaging, is more tolerant of random perturbations of the signals and a lower implementation complexity. In this case as well, there is typically a limit on how long you can average.

Cross correlations, or cross covariance of unknown or random signals such as in multiple sensor applications are usually suitable for complex averaging. If the equivalent transfer function between pairs of sensors is constant, the phase is synchronized and independent noise between sensors decorrelates.

The power spectrum of a stationary, or wide sense stationary random process doesn’t have a unique phase, so there is not a reason for complex averaging in that case.

One place where complex averaging is commonly used (and I dont have a lot of experience) is in coherent radar processing.