FFT gives different amplitudes for different freqeuncies

I have been working with FFTs for some time now and I just noticed this while I was trying to reproduce some results from simulations. The amplitude of the peak recovered with FFT changes with the the freqeuncy itself. Also, I noticed that different sampling frequencies on the same signal frequency produce a similar effect (with sampling freqeucny always higher than Nyquist). Lastly, I noticed that with sampling points around powers of two the effect is exxagerrated, with the delta function receovered by FFT being significantly broadened. WHy is this happenining?
Here is the code that I am using. Any help is appreciated!
sampling_points=2000;
f_s=3000; % Hz sampling frequency
time=(1:sampling_points)/f_s;
A=2;
for ii=1:100 %loop to produce spectra with different frequencies
freq(ii)=ii*1+10;
spectrum=A*cos(2*pi*freq(ii)*time); %make the spectrum
FFT_of_spectrum=fft(spectrum,[],2);
FFT_abs=2*abs(FFT_of_spectrum)/sampling_points; % rescale the fft
FFT_abs=FFT_abs(1:sampling_points/2);
FFT_abs(2:end-1)=FFT_abs(2:end-1);
peak(ii)=max(FFT_abs); % find the height of the peak
end
figure('name','FFT of time domain spectrum')
plot(FFT_abs);
xlabel('Frequency (Hz)');
ylabel('Amplitude');
figure('name','FFT of spectrum in depth domain')
plot(freq,peak)
xlabel('Frequency (Hz)');
ylabel('Amplitude of peak');

1 Commento

The only thing FFT conserves rigorously is the discrete l^2 energy (Parseval's theorem).
The max amplitudes does not conserves, especially even if you have a mono frequency signal, but falling n between 2 bins and/or not periodic. Though there are a strong correlation of max-amplitudes due to Parseval but no equality.
There exists also some mathematics bounds inequality between max-amplitude and L1 norm between f and FFT(f) and vice versa. But that's all.

Accedi per commentare.

 Risposta accettata

Hi Fabio,
Good observation. The reason for this is when there are an exact integer number of cycles in the time record, you have a periodic trig function and the fft gives the peak that you expect. When there are not an exact integer number of cycles in the time record, the function is still periodic in the time record (by definition of the fft), but the function being repeated is a trig function that's lopped off at the end. That function requires frequencies other than the fundamental to define it, which takes away from the amplitude of the fundamental and spreads the peak in the frequency domain.
For a time record of length T, the number of cycles n = fT, and here
T = N/fs = 2/3 sec
f = ii+10 (in Hz)
and
n = (ii+10)*2/3
Then n is an integer and you get a full peak a third of the time, when ii+10 is divisible by 3.

1 Commento

Hi David, thank you so much for your help! I think this really answers my question. Always fun to learn about signal theory!

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Programming in Centro assistenza e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by