#
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 $1 \Omega$ resistor and a $1\ \text{M} \Omega = 10^6 \Omega$ 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 $100\ \Omega \text{,}\ 1\ \text{K} \Omega \text{,}\ 10\ \text{K} \Omega \text{, or}\ 100\ \text{K} \Omega$ is far more important than whether it should be $1\ \text{K} \Omega \ \text{or}\ 2.2\ \text{K} \Omega$ .

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 $\log_2 16 = 4$ 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 $b=10$ is commonly used in engineering and is commonly written as $\log(x)$ . In mathematics, the natural base $b=e=2.71828\dots$ is commonly used and written as $\ln(x)$ . In computer science, base $b=2$ is commonly used and written as $\lg(x)$ . 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 $x(t)$ and $y(t) = 25 \cdot x(t)$ , 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 $10\text{X}$
increase in *voltage* through an amplifier results in a $10^2 = 100\text{X}$
increase in *power*, or +20dB.

Since $\frac {P_{out}} {P_{in}} = \big( \frac {V_{out}} {V_{in}} \big) ^2$ , 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 $10^8$ and a voltage multiplier of $10^4$ . In general, we can just invert the equations above for A dB:

The values for $\pm 3 \ \text{dB}$ and $\pm 6 \ \text{dB}$ are not exact but are common approximations, because:

These exact decibel values for multiplication by $2$ and $\sqrt{2}$ 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 $10^2$ in voltage and a factor of $10^4$ 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 $10^{-3}$ , 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 $\frac {1} {10}$ 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 $\frac {1} {2}$ 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 $f$ and double it three times (i.e. go up three octaves), we’ll end up with $2^3 \cdot f = 8 \cdot f$ – almost enough to reach $10 \cdot f$ , but not quite. If we double $f$ four times (i.e. go up four octaves), we’ll end up with $2^4 \cdot f = 16 \cdot f$ – 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 $k$ 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 $20 \log_{10} 2 \approx 6.0206$
.

## 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 $t$ 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 $y(x) = \frac {1} {1+x}$ 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 $x$ :

Now let’s define $p = \log x$ and $q = \log y$ . These represent the logarithmically-transformed $x$ and $y$ axes for plotting.

Now we have two very simple equations for lines which are good approximations for $q$ 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 $x$ we can transform to $p$ , and join the lines into a single approximation function (again looking only at positive $p$ due to the domain of logarithm):

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

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 $p$ from $10^{-5} \ \text{to} \ 10^{+5}$ – 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 $\hat{q}(p)$ is quite good for $p \le -1$ and $p \ge +1$ , which corresponds to $x \le 0.1$ and $x \ge 10$ . 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 $x^n$ 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 $x^{-1}$ . If the original fraction had $x^{-2}$ , 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 $1/f$ 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 $10^3$ . These make human-readable numbers simpler.

The abbreviation for micro is $\mu$ , 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: $22 \ \mu \text{F} = 22 \ \text{uF}$ , 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.)