Prev Next db20

Conversion to dB (decibels) in 20*log10 Form
Syntax y = db20(x)
Include: include spt\db20.oms
See Also db10

ARGUMENTS:
   INPUTS:
     x = MATRIX, any numerical type
   RETURN: MATRIX, 20*log10(x), type DOUBLE

Description

Returns the element-by-element value of twenty times the log base ten of the input matrix. Any numerical type may be input. INTEGER, REAL, and DOUBLE type are coerced to DOUBLE for internal processing. COMPLEX types are converted to their ABSOLUTE VALUE before local processing. Type returned is always DOUBLE.

This function is appropriate for quantities that may be interpreted as a fundamental quantity, such as amplitude, volts, etc. Input is converted to absolute value before processing to preserve the relative strength. If ZERO is input, a decibel value corresponding to the DOUBLE_EPSILON is returned.

Example

For vectors:

O>x = {-2, -1, 0, 2, 4, 20}
O>db20(x)
{
6.0206
0
-313.071
6.0206
12.0412
26.0206
}

For complxe values:

O>db20(3d0 + 4i0)
13.9794 

For matrices:

O>A = {[-10, 5],[.5, .125]}
O>db20(A)
{
[ 20 , 13.9794 ]
[ -6.0206 , -18.0618 ]
}