Convert energy or power measurements to decibels
dboutput = db(x)
dboutput = db(x,SignalType)
dboutput = db(x,R)
dboutput = db(x,'voltage',R)
Express a unit voltage in decibels. Assume that the resistance is 2 ohms. Compare the answer to the definition, .
V = 1; R = 2; dboutput = db(V,2); compvoltage = [dboutput 10*log10(1/2)]
compvoltage = -3.0103 -3.0103
Convert a vector of power measurements to decibels. Compare the answer to the result of using the definition.
rng default X = abs(rand(10,1)); dboutput = db(X,'power'); comppower = [dboutput 10*log10(X)]
comppower = -0.8899 -0.8899 -0.4297 -0.4297 -8.9624 -8.9624 -0.3935 -0.3935 -1.9904 -1.9904 -10.1082 -10.1082 -5.5518 -5.5518 -2.6211 -2.6211 -0.1886 -0.1886 -0.1552 -0.1552
x— Signal measurements
Signal measurements, specified as a scalar, vector, matrix, or N-D array.
Complex Number Support: Yes
SignalType— Type of signal measurements
Type of signal measurements, specified as either
If you specify
then all elements of
x must be nonnegative.
R— Resistive load
Resistive load, specified as a positive scalar expressed in
ohms. This argument is ignored if you specify
dboutput— Energy or power measurements in decibels
Energy or power measurements in decibels, returned as an array
with the same dimensions as
x contains voltage measurements,
If the input
x contains power