fast fourier tranform gives unequals amplitudes for frequencies with initially (before the fft) the same amplitude

조회 수: 1 (최근 30일)
Hi, I tried to find all the different frequencies in a sums of sinus using the fast fourier transform function in MATLAB. The fft function gives me the right frequencies, but with differents amplitude, even if all the amplitudes are equal to 1 (see the y vector). I really dont understand what im doing wrong. Thanks you very much for any information, don't hesitate to ask if you need more details about the question.
Here is the code I ran :
f = 3*10^6; %sampling frequency
t = 0:f^-1:1*10^-2-1*f^-1; %time vector
y = sin(2*pi*(1000*10^-9)^-1*t) + sin(2*pi*(1300*10^-9)^-1*t) + sin(2*pi*(900*10^-9)^-1*t) + sin(2*pi*(800*10^-9)^-1*t) + sin(2*pi*(700*10^-9)^-1*t) ;
Y = fft(y, 2^nextpow2(length(t)));
Amp = Y.*conj(Y)/length(Y);
frequ = f/length(Y)*(0:length(Y)/2);
plot(frequ,Amp(1:(length(Y))/2+1))

답변 (1개)

Walter Roberson
Walter Roberson 2020년 7월 4일
sin(2*pi*(900*10^-9)^-1*t)
(900*10^-9)^-1 is 1111111.11111111 Hz. But your sampling frequency is 32768. You have about 33.9 cycles of 1111111.11111111 Hz between every two adjacent samples. You have heavy aliasing.
Your sampling frequency also does not evenly divide your source frequencies, so your source frequencies are not going to fit into just one bin. The distribution between adjacent bins is going to depend on the exact frequency and ratios. So possibly one pair of adjacent bins might get hit 10% / 90% and another pair of adjacent bins might get hit 50% / 50%, but this does not mean that the amplitude is nearly twice as much at one frequency than the other: it just means that there is a bad fit between frequencies and binning.
  댓글 수: 3
Walter Roberson
Walter Roberson 2020년 7월 4일
I did miss the scaling by t. Your maximum t is 0.00999966666666667 so you are correct that you do not have aliasing.
However, you do have different number of bins for each frequency and that is going to lead to the data being split irregularly. If your frequencies were 1024, 1310.72, 910.2, then you would have less irregularity in the bin allocation.
Henri Paquette
Henri Paquette 2020년 7월 4일
Can I ask you how did you came up with theses values for the frequencies? Also, is there a way I can get the correct amplitude, after the fft, using arbitrary frequencies? Thanks a lot for your help.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by