Main Content

db2mag

Convert decibels to magnitude

Description

example

y = db2mag(ydb) returns the magnitude measurements, y, that correspond to the decibel (dB) values specified in ydb. The relationship between magnitude and decibels is ydb = 20 log10(y).

Examples

collapse all

Generate a 2-by-4-by-2 array of Gaussian random numbers. Assume the numbers are expressed in decibels and compute the corresponding magnitudes.

r = randn(2,4,2);

mags = db2mag(r)
mags = 
mags(:,:,1) =

    1.0639    0.7710    1.0374    0.9513
    1.2351    1.1044    0.8602    1.0402


mags(:,:,2) =

    1.5098    0.8561    1.0871    1.0858
    1.3755    1.4182    0.9928    0.9767

Use the definition to check the calculation.

chck = 10.^(r/20)
chck = 
chck(:,:,1) =

    1.0639    0.7710    1.0374    0.9513
    1.2351    1.1044    0.8602    1.0402


chck(:,:,2) =

    1.5098    0.8561    1.0871    1.0858
    1.3755    1.4182    0.9928    0.9767

Input Arguments

collapse all

Input array in decibels, specified as a scalar, vector, matrix, or N-D array. When ydb is nonscalar, db2mag is an element-wise operation.

Data Types: single | double

Output Arguments

collapse all

Magnitude measurements, returned as a scalar, vector, matrix, or N-D array of the same size as ydb.

Version History

Introduced in R2008a

See Also

| | |