I use Matlab to receive FFT signals, and I focus on normalizing. In particular, how to normalize the spectrum to units of dBm. I know that 0.316228 is the correct normalization factor, but my questions are related to how to properly normalize the boxes.
I created the following program to raise my questions. Just cut and paste it into Matlab and it will start by itself. See Questions in line.
In particular, I am confused about how to normalize bins. For example, if the FFT has indices 1: the end, where is the end even, when I calculate the spectrum of the FFT amplitudes, should I multiply by (2 / N) for indices 2: (end / 2)? Similarly, is the bin normalized at the Nyquist frequency (located at the end of the index / 2 + 1) to (1 / N)? I know that there are many ways to normalize depending on one interest. Let them say that the signal that I use (St below) is the voltage received from the ADC.
Any feedback is greatly appreciated. Thanks in advance!
%% 1. Create an Example Signal
N = 2^21 ; % N = number of points in time-domain signal (St)
St = 1 + rand(N,1,'single'); % St = example broadband signal (e.g. random noise)
% take FFT
Sf = fft(St, N);
Sf_mag = (2/N)*abs(Sf(1: N/2 + 1));
Sf_dBm = 20*log10(Sf_mag / 0.316228); % 0.316338 is peak voltage of 1 mW into 50 Ohms
% Q: Are Sf_mag and Sf_dBm normalized correctly? (assume 0.316338 is correct
% peak voltage to get 1mW in 50 Ohms)
% Q: Should Sf_mag(fftpoints/2 + 1) = (1/N)*abs(Sf(fftpoints/2 + 1) for correct normalization
% of Nyquist frequency? (since Nyquist frequency is not folded in frequency
% like the others are)
%% 2. Plot Result
% create FFT spectrum x-axis
samplerate = 20e9; % 20 Gsamples/sec
fft_xaxis = single(0 : 1 : N/2)';
fft_xaxis = fft_xaxis * single(samplerate/N);
semilogx(fft_xaxis, Sf_dBm, 'b-')
xlabel('Frequency (Hz)');
ylabel('FFT Magnitude (dBm)');
title('Spectrum of Signal (Blue) vs Frequency (Hz)');
xlim([1e4 1e10]);
grid on;
source
share