pow2db
Convert power to decibels
Syntax
Description
Examples
Power Spectrum of a Noisy Sinusoid
Generate 1024 samples of a noisy sinusoid having a normalized frequency of rad/sample. Estimate the power spectrum of the signal using pwelch
. Express the estimate in decibels and plot it.
n = 0:1024-1; x = cos(2*pi*n/3) + randn(size(n)); [pxx,w] = pwelch(x,'power'); dB = pow2db(pxx); plot(w/pi,dB) xlabel('\omega / \pi') ylabel('Power (dB)')
Repeat the computation using pwelch
without output arguments.
pwelch(x,'power')
Input Arguments
y
— Input array
scalar | vector | matrix | N-D array
Input array, specified as a scalar, vector, matrix, or N-D array. When
y
is nonscalar, pow2db
is an
element-wise operation.
Data Types: single
| double
Output Arguments
ydb
— Power measurements in decibels
scalar | vector | matrix | N-D array
Power measurements in decibels, returned as a scalar, vector, matrix, or
N-D array of the same size as
y
.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
GPU Arrays
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Version History
Introduced in R2007b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)