mag2db
Convert magnitude to decibels (dB)
Syntax
Description
Examples
Display Gain Margins in Decibels
For this example, consider the following SISO feedback loop where the system contains multiple gain crossover or phase crossover frequencies, which leads to multiple gain or phase margin values:
Create the transfer function.
G = tf(20,[1 7]) * tf([1 3.2 7.2],[1 -1.2 0.8]) * tf([1 -8 400],[1 33 700]);
Use the allmargin
command to compute all stability margins.
m = allmargin(G)
m = struct with fields:
GainMargin: [0.3408 3.3920]
GMFrequency: [1.9421 16.4807]
PhaseMargin: 68.1140
PMFrequency: 7.0776
DelayMargin: 0.1680
DMFrequency: 7.0776
Stable: 1
Note that gain margins are expressed as gain ratios and not in decibels (dB). Use mag2db
to convert the values to dB.
GainMargins_dB = mag2db(m.GainMargin)
GainMargins_dB = 1×2
-9.3510 10.6091
Input Arguments
y
— Input array
scalar | vector | matrix | array
Input array, specified as a scalar, vector, matrix, or an array. When
y
is nonscalar, mag2db
is an element-wise
operation.
Data Types: single
| double
Complex Number Support: Yes
Output Arguments
ydb
— Magnitude measurements in decibels
scalar | vector | matrix | array
Magnitude measurements in decibels, returned as a scalar, vector, matrix, or an
array of the same size as y
.
Version History
Introduced in R2008a
See Also
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)