db2mag
Builtin index · Signal processing
result = db2mag(db)
Input: db · Output: result
What it is
db: a number or vector (decibel value).
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = db2mag(db) | db number or vectornot documented yet | result — | Returns the same shape: 10^(db/20) — inverse of mag2db. |
Examples
From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.
amp = db2mag(-6) # amplitude ratio for -6 dB
pow = db2pow(-3) # power ratio for -3 dB
print("db2mag(-6) = {amp}, db2pow(-3) = {pow}")
w_hamming = hamming(8)
w_blackman = blackman(8)
w_kaiser = kaiser(9, 5) # beta=5, odd length so there's an exact center sample
print("hamming[0] = {w_hamming[0]}, blackman[0] = {w_blackman[0]}, kaiser center = {w_kaiser[4]}")
f = logspace(0, 3, 4) # 1, 10, 100, 1000 -- a log-spaced frequency axis
print("logspace(0,3,4) = {f}")
output
db2mag(-6) = 0.501187, db2pow(-3) = 0.501187 hamming[0] = 0.08, blackman[0] = -1.387779e-17, kaiser center = 1 logspace(0,3,4) = [1, 10, 100, 1000]
from signal-processing