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:

x : real

value to be converted. Should be positive and non null.

signal_type : string, optional

either ‘voltage’ or ‘power’. Defaults to ‘voltage’

R : real, optional

load resistance value. Defaults to 1.

Returns:

y : real

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.