control.mag2db

control.mag2db(mag)[source]

Convert a magnitude to decibels (dB).

If A is magnitude,

db = 20 * log10(A)

Parameters
magfloat or ndarray

Input magnitude or array of magnitudes.

Returns
dbfloat or ndarray

Corresponding values in decibels.

Examples

>>> ct.mag2db(10.0)                                         
20.0
>>> ct.mag2db(np.array([1, 0.01]))                          
array([  0., -40.])