#
1.2

Orders of Magnitude, Logarithmic Scales, and Decibels

Electrical engineering, to a degree more than many other fields of engineering, features coexisting, interacting quantities over many orders of magnitude. Both a resistor and a resistor are common, and it is not unusual to find a circuit board that features at least one of each.

Determining if a particular resistor should be is far more important than whether it should be .

Logarithms compress values from many orders of magnitude down to a smaller space. Some of the basic rules about logarithms to remember include:

(The equation is read aloud as: “The log-base-two of sixteen equals four.”)

If the base is not explicitly specified, the context usually determines the intended base. Base is commonly used in engineering and is commonly written as . In mathematics, the natural base is commonly used and written as . In computer science, base is commonly used and written as . If it’s ever unspecified and unclear, ask.

## Decibels

Taking a logarithm compresses multiplicative differences into additive differences. For example, if we have two functions and , then the logarithms (in any base) of these two functions will only differ by a constant:

This is a useful way of thinking about lots of electronic systems like amplifiers and filters, which in general apply multiplicative transformations to an input signal. With logarithms, we can think of that multiplicative transformation as just shifting the value up or down on the y-axis.

The decibels difference between two multiplicatively-related voltage or current signals is defined as:

where A is in dB. In this context, the logarithm is defined as being base 10.

Where does the factor 20 come from? The answer is that this was defined so that a 10X multiplicative increase in *power* would be equivalent to adding +10dB.

Because power is proportional to the square of voltage (which we’ll discuss in more detail in the Power section), a
increase in *voltage* through an amplifier results in a
increase in *power*, or +20dB.

Since , then:

(To avoid complicating the discussion of decibels at this early stage, we’re going to avoid talking about reference impedance here. As logarithms of negative numbers don’t exist, we’re also generally talking about the *envelope* or *amplitude* of the signal, rather than the signal waveform itself.)

Here are some common decibel values and hints about where they’re from:

It is not unusual to see decibel values outside these bounds: +80 dB represents a power multiplier of and a voltage multiplier of . In general, we can just invert the equations above for A dB:

The values for and are not exact but are common approximations, because:

These exact decibel values for multiplication by and are commonly truncated. That’s why engineers speak colloquially about +3 dB or +6 dB to refer to a power gain of 2 or a voltage gain of 2, respectively.

If we connected two amplifiers together in series, each of which had 10x voltage gain, then each would contribute +20dB gain. We can add the decibel values to get +40dB overall voltage gain – a factor of in voltage and a factor of in power.

## Absolute Decibel Units

Any unit specified only as “dB” refers only to a *relative* factor between signals.

However, it is often convenient to define the denominator as a specific unit-bearing quantity.

For example, “dBm” means “decibels relative to 1 milliwatt.” Therefore, +20 dBm represents “+20dB relative to 1 milliwatt.” As Watts are a unit of power, and +20 dB is a multiplication of 100X in power, then “+20 dBm” is simply a short way of saying “100 milliwatts.”

In another example, “dBV” means “decibels relative to 1 Volt.” Therefore, -60 dBv represents “-60dB relative to 1 volt.” As -60 dB in voltage is a voltage factor of , then “-60 dBV” is simply a short way of saying “1 millivolt.”

Be careful to track whether a decibel unit is relative or absolute, and whether the absolute reference represents a power or voltage level.

## Decibels Rolloff

In future sections when we talk about frequency response of amplifiers and filters, we will sometimes consider numbers like “-20 dB/decade” or “-6 dB/octave”.

A decade is a 10X increase in frequency, for example from 100 Hz to 1000 Hz. Saying “minus 20 dB per decade” might mean that the output signal at 1000 Hz is only as large in voltage amplitude as the signal at 100 Hz.

An octave is a 2X increase in frequency, just as it is in music. For example 100 Hz and 200 Hz are one octave apart. Saying “minus 6 dB per octave” might mean that the output signal at 200 Hz is only as large in voltage amplitude as the signal at 100 Hz.

It turns out that these two examples are actually referring to the same thing:

Let’s prove it. How many octaves are in a decade?

If we start at frequency and double it three times (i.e. go up three octaves), we’ll end up with – almost enough to reach , but not quite. If we double four times (i.e. go up four octaves), we’ll end up with – more than a decade; we’ve gone too far. The real number of octaves necessary to complete a decade is between three and four, and is shown as above.

If our signal is reduced by -6 dB/octave, and we go up in frequency by 3.322 octaves, the total reduction is:

That -19.932 dB is really *precisely -20dB* when we account for the fact that -6 dB is only a rounded-off approximation for
.

## Semi-Logarithmic Plotting

On a semi-log plot, the y-axis is plotted on a logarithmic scale while the x-axis remains linear. This turns functions that are exponentially changing (with any base) into straight lines. For example, consider the value of a savings account with initial value 1000 growing at 5% per year, with time in years. The value of the account is:

If we take the log,

The logarithm has transformed an exponential (with base 1.05) into a straight line.

For a similar example, plotting the value of a stock or mutual fund should be done on a semi-log plot. (It should also be plotted with dividends reinvested to show total returns, though this is a separate issue we can’t address here.) Why logarithmic? Because if we plot with a linear scale, it looks like all the growth has happened in just the last few years. If we plot with a logarithmic scale, it reveals that in fact an investor at roughly any point has roughly doubled their investment value in about a decade. This reflects the idea that in general, in any given year, the company’s profit (whether retained earnings or distributed as dividends) will be roughly a few percent of its current value.

To see for yourself, load this data, click “Max” to set the maximum timescale from 1970 onwards. The linear graph looks absolutely tiny for the first half of the dataset. Now, click “Edit Graph”, click “Format”, and check the box next to “Log Scale”; if the horizontal scale resets you may have to click “Max” again. Now, while it’s not smooth or consistent or risk free, you’d see that in fact the general trend of growth (in a %/year growth sense) has been present for many decades.

## Log-Log Plotting

If plotting with a logarithmic scale on the y-axis is powerful, then plotting with a logarithmic scale on both the x-axis and y-axis is really powerful.

Consider our function that we used for computing various approximations in the Algebraic Approximations section. Taking the log of both sides:

This alone doesn’t look very easy to understand, but let’s again apply various approximations in different limiting asymptotes for :

Now let’s define and . These represent the logarithmically-transformed and axes for plotting.

Now we have two very simple equations for lines which are good approximations for in different regimes: the first section has a slope of 0 (a horizontal line), and the second section has a slope of -1. The approximation line will do badly near the “knee” where the two approximations meet, but will do well everywhere else.

Instead of defining these in terms of we can transform to , and join the lines into a single approximation function (again looking only at positive due to the domain of logarithm):

Finally, we can join these at by seeing that we can take the minimum value of either segment at any given :

This is simply a compact representation of the two segments above, but importantly, it is a representation that the mathematical expression evaluation software inside CircuitLab knows how to handle directly using the MIN(a,b) notation – see the documentation on expressions for more information.

We’ll show how good the log-log plot is by considering value of from – a factor of 10 billion from bottom to top!

Exercise Click the “circuit” shown above, then click “Simulate”, then “Run DC Sweep”. You’ll see two lines plotted:

The approximation is quite good for and , which corresponds to and . In the middle, neither approximation is excellent, but the error can be quantified now that we know it’s there.

We’ve taken a complicated-looking fraction and turned it into a collection of straight line segments by using two tools: log-log plots and asymptotic approximations. That’s the power of log-log plotting: it turns rational polynomials (fractions with in the numerator or denominator) into straight line approximations that work over many orders of magnitude.

Note that the second line segment has slope -1, corresponding to . If the original fraction had , the slope would be -2.

Log-log plots and the straight line approximation concept will come up again when we look at filters and amplifiers and frequency response. Log-log is a great fit there because the independent variable (frequency) varies over many orders of magnitude, as does the dependent variable (amplification of magnitude).

And, as we’ll see, the frequency response of common filters can be described by rational polynomials, so we’ll get straight line segment approximations there too when using these same tools. For example, a simple RC low-pass filter will have a amplitude response for frequencies above its corner frequency, mapping precisely to the example we’ve just illustrated.

If the concepts of asymptotic approximations, semi-log, and log-log plots are still unfamiliar, you’re encouraged to brush up and explore these concepts on paper and/or in simulation, as they will come up again and again as we go.

## Metric Decimal Unit Prefixes

As electronic quantities span many orders of magnitude, it’s common in electronics to use unit prefixes that help designate orders-of-magnitude at various powers of . These make human-readable numbers simpler.

The abbreviation for micro is , the Greek lowercase letter mu. However, because this is hard to type into a computer, it’s often written with just the lowercase letter u: , but is spoken aloud as “twenty two micro Farads” either way.

Most electronics software, including the CircuitLab simulation software, will understand these prefixes if the prefix comes immediately after the digits of the number (with no space in between). For example, you can enter “2.2k” in the value field for a resistor to get a 2200 ohm resistance. One confusing case is that mega is represented by uppercase “M” and milli is represented by lowercase “m”; modern software like CircuitLab will interpret these two correctly as written, but some older SPICE-based circuit software dates back to the 1970s and can’t handle the difference between uppercase and lowercase characters! These older programs instead use “MEG” to denote mega. Be careful that the computer interprets your value correctly.

## What’s Next

In the next section, Complex Numbers, we’ll talk about real and imaginary numbers and their connection to circles, trigonometry, and sine waves. (Later, we’ll connect complex numbers with our algebraic approximations & log-log plotting to explore the frequency domain.)

**Ultimate Electronics: Practical Circuit Design and Analysis.**CircuitLab, Inc., 2019, ultimateelectronicsbook.com. Accessed . (Copyright © 2019 CircuitLab, Inc.)