The watt to dBm conversion follows the following rule:
dBW = 10 * log10(P[w])
dBm = 10 * log10(1000 * P[w])
= 10 * log10(P[w]) + 10 * log10(1000)
= 10 * log10(P[w]) + 10 * 3
= 10 * log10(P[w]) + 30
= dBW + 30
Hence, the inverse path will be:
P[w] = 10 ^ ((P[dBm] - 30) / 10);
Thus, in Matlab:
P_w = 47;
P_dBm = 10 ^ ((P_w - 30) / 10); % 50.12
solved How to convert dbm to watts on Matlab