mag2db() - Signal Processing
ydb = mag2db(y) expresses
in decibels (dB) the magnitude measurements specified in y.
The relationship between magnitude and decibels is ydb = 20 log10(y).
Syntax
ydb = mag2db(y) example
Example
Magnitude Response of a Highpass FilterOpen This ExampleDesign 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)
Output / Return Value
Limitations
Alternatives / See Also
Reference