pydsm.relab.db¶
-
pydsm.relab.
db
(x, signal_type='voltage', R=1)¶ Converts a value to dB a la Matlab
This function tries to replicate the
dB
interface of Matlab.- Parameters
- xreal
value to be converted. Should be positive and non null.
- signal_typestring, optional
either ‘voltage’ or ‘power’. Defaults to ‘voltage’
- Rreal, optional
load resistance value. Defaults to 1.
- Returns
- yreal
value in dB corresponding to x if signal_type is ‘power’ the result is 10*log10(x). Otherwise (if signal_type is ‘voltage’), then power is measured over resistor R
Notes
The default R value assures that when signal_type is ‘voltage’ dB defaults to the classical 20*log10(x) computation.