필터 지우기
필터 지우기

how to convert the single sided fft output into dBm

조회 수: 54 (최근 30일)
Naufal Arfani
Naufal Arfani 2021년 2월 18일
답변: Kautuk Raj 2024년 2월 21일
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)|')

답변 (1개)

Kautuk Raj
Kautuk Raj 2024년 2월 21일
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:

카테고리

Help CenterFile Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by