![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/200185/image.png)
convert from linear units to dBm and dB
72 views (last 30 days)
Show older comments
I have this equation:
y_linear=10.^((x_dbm-30)/20);
I have the value of y_linear and I want to get the value of x_dbm in dBm and dB units. can anyone help me with this?
0 Comments
Answers (2)
Star Strider
on 4 Jan 2019
This is relatively straightforward. To solve it analytically, take
of both sides, then rearrange to get:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/200185/image.png)
x_dbm = 20*log10(y_linear) + 30;
However if you want to use the fzero function to solve it:
y_linear = 42
y_linfcn = @(xdbm) 10.^((xdbm-30)/20);
x_dbm = fzero(@(xdbm) y_linfcn(xdbm)-y_linear, 1)
x_dbm =
62.464985807958
2 Comments
TJ Plummer
on 17 Mar 2020
Edited: TJ Plummer
on 17 Mar 2020
So dB is a measure of power relative to 1 Watt and dBm is measure of power relative to 1 Milliwatt.
x_in = 5.3; % Volts
Covert input (linear) level, typically an rms Volt value to Power levels.
X_dB = 20 * log10(x_in);
x_in = 10^(X_dB / 20);
X_dBm = X_dB + 30; % 30dB is 10 * log10(1W/1mW)
x_in = 10^((X_dBm - 30) / 20);
x_in_dBm = x_in * 10^(30 / 20);
To recap, it is easier to add and subtract in dB space than divide or multiply in linear. dB is a unit to measure power where input is the amplitude units (rms Volts in my example). Going from dB to dBm is an 30dB difference in power. This is a factor of 1000 in linear Power. To convert to linear amplitude units, this becomes a scaling of sqrt(1000).
2 Comments
TJ Plummer
on 18 Mar 2020
Sure, where you have:
ZdBm=X_dbm-Ydbm;
This is incorrect. A difference in any dB units is simply dB. Recall that subtraction is a ratio. Therefore, your units get cancelled, which leaves you with regular dB:
ZdB = X_dbm - Ydbm;
Now the 30 is not needed in the conversion back to linear. Remember the m in dBm denotes units of miliwatt.
ZLinear=10.^((ZdB)/20);
See Also
Categories
Find more on Filter Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!