mag2db
Convert magnitude to decibels
Syntax
Description
Examples
Magnitude Response of a Highpass Filter
Design a 3rd-order highpass Butterworth filter having a normalized 3-dB frequency of rad/sample. Compute its frequency response. Express the magnitude response in decibels and plot it.
[b,a] = butter(3,0.5,'high'); [h,w] = freqz(b,a); dB = mag2db(abs(h)); plot(w/pi,dB) xlabel('\omega / \pi') ylabel('Magnitude (dB)') ylim([-82 5])
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, mag2db
is an
element-wise operation.
Data Types: single
| double
Output Arguments
ydb
— Magnitude measurements in decibels
scalar | vector | matrix | N-D array
Magnitude measurements in decibels, returned as a scalar, vector, matrix, or
N-D array of the same size as
y
.
Version History
Introduced in R2008a
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)