I reckon that you wish to convert the single-sided FFT output of a noisy signal into dBm units to compare with spectrum analyser readings.
To convert the single-sided FFT output into dBm, the following steps need to be followed:
- Calculate the Power: The power of the signal in watts (W) is proportional to the square of its amplitude. For each frequency bin, you'll need to calculate the power based on the FFT output.
- Convert to Milliwatts (mW): Convert the power from watts to milliwatts (1 W = 1000 mW).
- Convert to dBm: The dBm value is a logarithmic representation of power relative to 1 milliwatt. The formula to convert from mW to dBm is:
The example code can be modified to include these steps:
S = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t);
X = S + 2*randn(size(t));
P1(2:end-1) = 2*P1(2:end-1);
P1_dBm = 10 * log10(P1_mW);
title('Single-Sided Amplitude Spectrum of X(t) in dBm')
The plot obtained using this code looks like: