# The Average of the Log is Not the Log of the Average

Blog Post created by benz on Sep 23, 2016

Originally posted Feb 12, 2013

Except sometimes it is

Reducing measurement variance is important for accuracy and resolution, and some sort of averaging is common in many measurement situations.  In a spectrum or signal analyzer, for example, there are so many potential averaging processes that one or more are likely to be operating on your measurements even if you don’t actively select one.  I’ll have more detail in future posts, but in this one I’ll discuss something more fundamental:  log and linear averaging scales.

Specifically, when you’re averaging signal measurements should you (or your analyzer) compute the average of the log-scaled value of the signal or instead average the linear power values (Watts) and then express the result in dB?  The first approach averages the log-scaled signal or data, essentially averaging the dB values.  It’s the kind of averaging performed by traditional swept spectrum analyzers as “video” averaging, operating the same whether an analyzer uses an analog or digital IF section.

The alternative approach of averaging power first and then converting to dB corresponds to what a power sensor/power meter combination would do.  It expresses the energy or heating value of a signal, regardless of signal characteristics.

Both of these approaches have their advantages and the tradeoffs will be discussed in posts to come.  First it’s important to understand the difference between averaging the log and log-scaling the average.  The graphic below details one example:

For this non-CW signal the average of the log power does not equal the log of the average power

Here a square wave modulates a sine wave, switching its amplitude equally between 1mW and 4mW or between 0 dBm and 6 dBm.  The average power is 2.5mW or 3.98 dBm, but if you just average the dB measurements instead you get 3 dBm.

For CW signals the average of the log does equal the log of the average, and this example points to the problem with averaging dB or dBm readings for non-CW signals such as digital modulation, noise, or other dynamic signals.  The difference between the two averaging approaches is not constant but depends on signal statistics.

However as mentioned above the video bandwidth filtering in swept spectrum analyzers normally averages the log readings.  That’s not a problem for the CW signals these analyzers were originally designed to measure, and corrections for signals with known statistics (such as Gaussian noise) are straightforward.  It can be a problem for many other signals, though, and modern signal analyzers (especially those from Agilent Technologies) do a good job of configuring their averaging for accurate results based on the type of measurement being made and other user settings.

Averaging is a rich and important topic in today’s world of complex and dynamic signals and stringent requirements for accuracy.  I’ll have more on this topic in posts to come.