-
sdr.db(x: ArrayLike, type: 'value' | 'power' | 'voltage' =
'value'
) NDArray[float_] Converts from linear units to decibels.
- Parameters:¶
- x: ArrayLike¶
The input value or signal.
- type: 'value' | 'power' | 'voltage' =
'value'
¶ The type of input value or signal.
"value"
: The input value/signal is any value.
\[x_{\text{dB}} = 10 \log_{10} x_{\text{linear}}\]"power"
: The input value/signal is a power measurement.
\[P_{\text{dB}} = 10 \log_{10} P_{\text{linear}}\]"voltage"
: The input value/signal is a voltage measurement.
\[V_{\text{dB}} = 20 \log_{10} V_{\text{linear}}\]
- Returns:¶
The value or signal in dB.
Examples¶
Convert 50 MHz to 77 dB-Hz.
In [1]: sdr.db(50e6) Out[1]: 76.98970004336019
Convert 100 mW to 20 dBm.
In [2]: sdr.db(100, type="power") Out[2]: 20.0
Convert 2 V to 6 dBV.
In [3]: sdr.db(2, type="voltage") Out[3]: 6.020599913279624