dB (FPScript)

21.09.2021

Converts an amplitude or power signal into decibels.

Syntax

dB(DataSet [ , SignalType = DB_POWER + DB_NORMALIZE ])
or
dB(DataSet, Reference, SignalType)

 

The syntax of the dB function consists of the following parts:

Part

Description

DataSet

The data to be converted into decibels.

All data structures are allowed. All numeric data types are permitted, except calendar time und time span.

For complex data types the absolute value is formed.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

Reference

A reference value by which all values of DataSet are divided before logarithmization.

Permitted data structures are scalar value. All numeric data types are permitted. The unit has to be compatible with that of parameter DataSet.

For complex data types the absolute value is formed.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

SignalType

Specifies whether the data should be interpreted as amplitude or power. After logarithmization, the value 20 is multiplied for amplitudes and the value 10 is multiplied for powers. The factor of 10 is the result from the unit decibel, which is one tenth of a bel. The additional factor of 2 for amplitudes corresponds to a squaring of the amplitudes before the logarithmization, which is necessary to form the signal power from the amplitude.

The argument SignalType can have the following values:

Constant

Meaning

DB_POWER

Interprets the data as power.

DB_AMPLITUDE

Interprets the data as amplitude.

+ DB_NORMALIZE

Normalizes the data by dividing by its maximum value. For signal series and data matrices, the global maximum value is determined across all columns.

+ DB_NORMALIZE_PER_COLUMN

Normalizes the data by dividing by its maximum value. For signal series and data matrices, the maximum value is determined for each column.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value DB_POWER + DB_NORMALIZE.

Remarks

The result has the same structure as the argument DataSet. The calculation is done element by element where appropriate.

The result has the unit dB.

If necessary, it is first normalized, then the real logarithm function is calculated to base 10 and finally multiplied by the value 20 or 10. If you do not specify a reference value and do not choose normalization to the maximum value, or DataSet is a scalar value, then this corresponds to a normalization to the value 1 in the unit of DataSet. DataSet must be positive. For each negative value of DataSet the function returns a void value. The result is of the 64-bit floating point value data type.

Available in

FlexPro View, Basic, Professional, Developer Suite

Examples

dB(1)

Results in 0.

dB(10)

Results in 10.

dB(10, DB_AMPLITUDE)

Results in 20.

dB(-1)

Results in ?.

dB(FFTn(Signal), DB_AMPLITUDE + DB_NORMALIZE)

Calculates a magnitude spectrum in dB normalized to 0 dB.

dB(PSD, PSDRef, DB_POWER)

Calculates a power density spectrum in dB normalized to the value PSDRef.

See Also

Log10 Function

Share article or send as email:

You might be interested in these articles