Skip to content

Instantly share code, notes, and snippets.

@endolith
Last active August 30, 2015 10:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save endolith/127445 to your computer and use it in GitHub Desktop.
Save endolith/127445 to your computer and use it in GitHub Desktop.
Custom unit definitions for GNU Units
# Custom unit definitions for GNU Units
# http://www.gnu.org/software/units/
# The bel was defined by engineers of Bell Laboratories to describe the
# reduction in audio level over a length of one mile. It was originally
# called the transmission unit (TU) but was renamed around 1923 to honor
# Alexander Graham Bell. The bel proved inconveniently large so the decibel
# has become more common. It is used in various to contexts to report a
# signal's power relative to some reference level.
bel(x) [1;1] 10^(x); log(bel) # Basic bel definition
dB(x) [1;1] 10^(x/10); 10 log(dB) # Basic decibel definition
dBW(x) [1;W] dB(x) W ; ~dB(dBW/W) # Reference = 1 W
dBk(x) [1;W] dB(x) kW ; ~dB(dBk/kW) # Reference = 1 kW
dBf(x) [1;W] dB(x) fW ; ~dB(dBf/fW) # Reference = 1 fW
dBm(x) [1;W] dB(x) mW ; ~dB(dBm/mW) # Reference = 1 mW
dBmW(x) [1;W] dBm(x) ; ~dBm(dBmW) # Reference = 1 mW
# When used to measure amplitude, voltage, or current the signal is squared
# because power is proportional to the square of these measures. Usually
# defined for a root-mean-square measurement.
dBV(x) [1;V] dB(0.5 x) V ; ~dB(dBV^2 / V^2) # Reference = 1 V
dBmV(x) [1;V] dB(0.5 x) mV ; ~dB(dBmV^2 / mV^2) # Reference = 1 mV
dBuV(x) [1;V] dB(0.5 x) microV ; ~dB(dBuV^2 / microV^2) # Reference = 1 microvolt
# Referenced to the voltage that causes 1 mW dissipation in a 600 ohm load:
dBu(x) [1;V] dB(0.5 x) sqrt(1 mW * 600 ohm) ; \
~dB(dBu^2/sqrt(1 mW * 600 ohm)^2)
dBv(x) [1;V] dBu(x) ; ~dBu(dBv) # Synonym for dBu
# Commonly used for sound pressure level measurements, reference = 20 uPa:
dBSPL(x) [1;Pa] dB(0.5 x) 20 microPa ; ~dB(dBSPL^2 / (20 microPa)^2)
# Numbers
eleven 11
twelve 12
thirteen 13
fourteen 14
fifteen 15
sixteen 16
seventeen 17
eighteen 18
nineteen 19
# The actual character is not on my keyboard
u- micro
# Unofficial abbreviation
RMB CNY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment