- 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:
how to convert the single sided fft output into dBm
65 次查看(过去 30 天)
显示 更早的评论
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)|')
0 个评论
回答(1 个)
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:
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:
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spectral Measurements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!