SignalUtils.AmpltToDb Method

Double AmpltToDb(TDenseMtxVec Data, Double Base, Double Span, Double aMax, Boolean Normalized)

Convert amplitude to decibels in place.

#NameDescription
1DataAmplitude data
2converted to dB in place.
3BaseLogarithm base
4use 10 for decibels.
5SpanDynamic range in dB
6output is clipped at -Span.
7aMaxReference amplitude X_(max).
8NormalizedWhen True, peak maps to 0 dB and floor to -Span.

Returns: Double - The clipping floor -Span.

Remarks:

Converts the amplitude data in Data to a decibel scale in place, using X_(dB) = 20 log_(Base)(X/X_(max)), clipped from below at -Span. Use Base =10 for true decibels; the scale factor is fixed at 20 (so this is the amplitude, not the power, convention). Span is the dynamic range in dB: any value mapping below -Span is set to -Span. When Normalized is False the reference X_(max) = aMax is used as given; when Normalized is True the data is normalized so its maximum becomes 0 dB and its floor -Span. If aMax is not positive every output is set to -Span. The function returns -Span.