Borrar filtros
Borrar filtros

how to convert the single sided fft output into dBm

58 visualizaciones (últimos 30 días)
Naufal Arfani
Naufal Arfani el 18 de Feb. de 2021
Respondida: Kautuk Raj el 21 de Feb. de 2024
I use the example code for fft mathworks below to get a single sided fft output, but I want to convert it into dBm form does anyone know the website about the formula or code I need to add, because I want to compare it with a spectrum analyzer output in the form dBm, thank you
Fs = 1000; % Sampling frequency
T = 1/Fs; % Sampling period
L = 1500; % Length of signal
t = (0:L-1)*T; % Time vector
S = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t);
X = S + 2*randn(size(t));
plot(1000*t(1:50),X(1:50))
title('Signal Corrupted with Zero-Mean Random Noise')
xlabel('t (milliseconds)')
ylabel('X(t)')
Y = fft(X);
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
plot(f,P1)
title('Single-Sided Amplitude Spectrum of X(t)')
xlabel('f (Hz)')
ylabel('|P1(f)|')
Y = fft(S);
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
plot(f,P1)
title('Single-Sided Amplitude Spectrum of S(t)')
xlabel('f (Hz)')
ylabel('|P1(f)|')

Respuestas (1)

Kautuk Raj
Kautuk Raj el 21 de Feb. de 2024
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:
  1. 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.
  2. Convert to Milliwatts (mW): Convert the power from watts to milliwatts (1 W = 1000 mW).
  3. 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:
Fs = 1000; % Sampling frequency
T = 1/Fs; % Sampling period
L = 1500; % Length of signal
t = (0:L-1)*T; % Time vector
S = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t);
X = S + 2*randn(size(t));
Y = fft(X);
P2 = abs(Y/L).^2; % Power of each freq component in W (not squared because of single-sided)
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1); % Only need to double non-DC/non-Nyquist components
P1_mW = P1 * 1000; % Convert power from W to mW
P1_dBm = 10 * log10(P1_mW); % Convert power from mW to dBm
f = Fs*(0:(L/2))/L;
plot(f, P1_dBm)
title('Single-Sided Amplitude Spectrum of X(t) in dBm')
xlabel('f (Hz)')
ylabel('Power (dBm)')
The plot obtained using this code looks like:

Categorías

Más información sobre Fourier Analysis and Filtering en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by