-
Notifications
You must be signed in to change notification settings - Fork 54
/
_undbv.py
50 lines (36 loc) · 1.3 KB
/
_undbv.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# -*- coding: utf-8 -*-
# _undbv.py
# This module provides the undbv function.
# Copyright 2013 Giuseppe Venturini
# This file is part of python-deltasigma.
#
# python-deltasigma is a 1:1 Python replacement of Richard Schreier's
# MATLAB delta sigma toolbox (aka "delsigma"), upon which it is heavily based.
# The delta sigma toolbox is (c) 2009, Richard Schreier.
#
# python-deltasigma is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# LICENSE file for the licensing terms.
"""This module provides the undbv() function.
"""
from __future__ import division
import numpy as np
from ._utils import carray, restore_input_form, save_input_form
def undbv(x):
"""Convert ``x`` from dB to voltage.
The conversion is carried out according to the relationship:
.. math::
V_{\\mathrm{RMS}} = 10^{x/20}
**Parameters:**
x : scalar or sequence
The signal in dB to be converted.
**Returns:**
Vrms : scalar or sequence
The RMS voltage corresponding to x.
.. seealso:: :func:`undbm`, :func:`undbp`, :func:`dbv`, :func:`db`
"""
iform = save_input_form(x)
x = carray(x)
up = 10.**(x/20.)
return restore_input_form(up, iform)