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])
Repeat the computation using fvtool
.
fvtool(b,a)
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
Ouvrir l'exemple
Vous possédez une version modifiée de cet exemple. Souhaitez-vous ouvrir cet exemple avec vos modifications ?
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.
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)