# db2mag

Convert decibels (dB) to magnitude

## Syntax

``y = db2mag(ydb)``

## 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\ast {\mathrm{log}}_{10}\left(y\right)$```

## Examples

collapse all

For this example, generate a 2-by-3-by-4 array of Gaussian random numbers. Assume the numbers are expressed in decibels and compute the corresponding magnitudes.

```rng('default'); ydb = randn(2,3,4); y = db2mag(ydb)```
```y = y(:,:,1) = 1.0639 0.7710 1.0374 1.2351 1.1044 0.8602 y(:,:,2) = 0.9513 1.5098 0.8561 1.0402 1.3755 1.4182 y(:,:,3) = 1.0871 1.0858 0.9858 0.9928 0.9767 1.1871 y(:,:,4) = 1.1761 1.0804 1.0861 1.1772 0.8702 1.2065 ```

Use the definition to check the calculation.

`chck = 10.^(ydb/20)`
```chck = chck(:,:,1) = 1.0639 0.7710 1.0374 1.2351 1.1044 0.8602 chck(:,:,2) = 0.9513 1.5098 0.8561 1.0402 1.3755 1.4182 chck(:,:,3) = 1.0871 1.0858 0.9858 0.9928 0.9767 1.1871 chck(:,:,4) = 1.1761 1.0804 1.0861 1.1772 0.8702 1.2065 ```

## Input Arguments

collapse all

Input array in decibels, specified as a scalar, vector, matrix, or an 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 an array of the same size as `ydb`.