Next: , Previous: User-Defined Units, Up: Units

11.5 Logarithmic Units

The units dB (decibels) and Np (nepers) are logarithmic units which are manipulated differently than standard units. Calc provides commands to work with these logarithmic units.

Decibels and nepers are used to measure power quantities as well as field quantities (quantities whose squares are proportional to power); these two types of quantities are handled slightly different from each other. By default the Calc commands work as if power quantities are being used; with the H prefix the Calc commands work as if field quantities are being used.

The decibel level of a power P1, relative to a reference power P0, is defined to be 10 log10(P1/P0) dB. (The factor of 10 is because a decibel, as its name implies, is one-tenth of a bel. The bel, named after Alexander Graham Bell, was considered to be too large of a unit and was effectively replaced by the decibel.) If F is a field quantity with power P=k F^2, then a reference quantity of F0 would correspond to a power of P0=k F0^2. If P1=k F1^2, then

     10 log10(P1/P0) = 10 log10(F1^2/F0^2) = 20 log10(F1/F0).

In order to get the same decibel level regardless of whether a field quantity or the corresponding power quantity is used, the decibel level of a field quantity F1, relative to a reference F0, is defined as 20 log10(F1/F0) dB. For example, the decibel value of a sound pressure level of 60 uPa relative to 20 uPa (the threshold of human hearing) is 20 log10(60 uPa/ 20 uPa) dB = 20 log10(3) dB, which is about 9.54 dB. Note that in taking the ratio, the original units cancel and so these logarithmic units are dimensionless.

Nepers (named after John Napier, who is credited with inventing the logarithm) are similar to bels except they use natural logarithms instead of common logarithms. The neper level of a power P1, relative to a reference power P0, is (1/2) ln(P1/P0) Np. The neper level of a field F1, relative to a reference field F0, is ln(F1/F0) Np.

For power quantities, Calc uses 1 mW as the default reference quantity; this default can be changed by changing the value of the customizable variable calc-lu-power-reference (see Customizing Calc). For field quantities, Calc uses 20 uPa as the default reference quantity; this is the value used in acoustics which is where decibels are commonly encountered. This default can be changed by changing the value of the customizable variable calc-lu-field-reference (see Customizing Calc). A non-default reference quantity will be read from the stack if the capital O prefix is used.

The l q (calc-lu-quant) [lupquant] command computes the power quantity corresponding to a given number of logarithmic units. With the capital O prefix, O l q, the reference level will be read from the top of the stack. (In an algebraic formula, lupquant can be given an optional second argument which will be used for the reference level.) For example, 20 dB <RET> l q will return 100 mW; 20 dB <RET> 4 W <RET> O l q will return 400 W. The H l q [lufquant] command behaves like l q but computes field quantities instead of power quantities.

The l d (calc-db) [dbpower] command will compute the decibel level of a power quantity using the default reference level; H l d [dbfield] will compute the decibel level of a field quantity. The commands l n (calc-np) [nppower] and H l n [npfield] will similarly compute neper levels. With the capital O prefix these commands will read a reference level from the stack; in an algebraic formula the reference level can be given as an optional second argument.

The sum of two power or field quantities doesn't correspond to the sum of the corresponding decibel or neper levels. If the powers corresponding to decibel levels D1 and D2 are added, the corresponding decibel level “sum” will be

       10 log10(10^(D1/10) + 10^(D2/10)) dB.

When field quantities are combined, it often means the corresponding powers are added and so the above formula might be used. In acoustics, for example, the sound pressure level is a field quantity and so the decibels are often defined using the field formula, but the sound pressure levels are combined as the sound power levels, and so the above formula should be used. If two field quantities themselves are added, the new decibel level will be

       20 log10(10^(D1/20) + 10^(D2/20)) dB.

If the power corresponding to D dB is multiplied by a number N, then the corresponding decibel level will be

       D + 10 log10(N) dB,

if a field quantity is multiplied by N the corresponding decibel level will be

       D + 20 log10(N) dB.

There are similar formulas for combining nepers. The l + (calc-lu-plus) [lupadd] command will “add” two logarithmic unit power levels this way; with the H prefix, H l + [lufadd] will add logarithmic unit field levels. Similarly, logarithmic units can be “subtracted” with l - (calc-lu-minus) [lupsub] or H l - [lufsub]. The l * (calc-lu-times) [lupmul] and H l * [lufmul] commands will “multiply” a logarithmic unit by a number; the l / (calc-lu-divide) [lupdiv] and H l / [lufdiv] commands will “divide” a logarithmic unit by a number. Note that the reference quantities don't play a role in this arithmetic.