convert from linear units to dBm and dB

113 views (last 30 days)
yusra Ch
yusra Ch on 4 Jan 2019
Commented: TJ Plummer on 18 Mar 2020
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?

Answers (2)

Star Strider
Star Strider on 4 Jan 2019
This is relatively straightforward. To solve it analytically, take of both sides, then rearrange to get:
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
yusra Ch
yusra Ch on 17 Mar 2020
Edited: yusra Ch on 17 Mar 2020
Hi again ,
If I have values of X in dBm and Y in dBm too.
XLinear=10.^((X_dbm-30)/20);
YLinear=10.^((Y_dbm-30)/20);
ZLinear=XLinear-YLinear;
ZdBm=X_dbm-Y_dbm;
ZLinear=10.^((ZdBm-30)/20);
why the result of this two operations is diffrent ?
Star Strider
Star Strider on 17 Mar 2020
Subtracting logs = dividing linear

Sign in to comment.


TJ Plummer
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
yusra Ch
yusra Ch on 18 Mar 2020
In my case, the input is the loss attenuation (in dBm). My prof told me that it is acceptable to do the substruction in log units in this case. But I dont understand why ?? Could you plz axplain to me ?
ANd if it is acceptable why the result of this two operations is diffrent (first Zlinear is not equal to the econd Zlinear)?
If I have values of X in dBm and Y in dBm too.
XLinear=10.^((X_dbm-30)/20);
YLinear=10.^((Y_dbm-30)/20);
ZLinear=XLinear-YLinear;
ZdBm=X_dbm-Y_dbm;
ZLinear=10.^((ZdBm-30)/20);
TJ Plummer
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);

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!