fft vs nufft- scaling
조회 수: 15 (최근 30일)
이전 댓글 표시
I tried to do a fast fourier transform to a non-uniformly sampled data using nufft. The order of magnitude of the results was weird so I tried to compare the results of MATLAB's fft example. The results seem identical except for a scaling factor of about 550. see attahced script and attached picture of the results from the script.
where does this order of magnitude difference come from? how should I scale the nufft results? It seems pretty obvious that the nufft is the "problematic one" as the magnitude of the fft is approximatly equal to the multiplier (~0.7, 1) in the original signal.
many thanks
Nathan
댓글 수: 0
채택된 답변
David Goodmanson
2022년 8월 6일
Hi Nathan,
In the fft case you are dividing by N = 1500 and multiplying by 2. For nufft you aren't doing that. Hence the factor of about 750.
댓글 수: 3
David Goodmanson
2022년 8월 6일
편집: David Goodmanson
2022년 8월 6일
There are two reasons. The factor of N is basic. Ignoring some off-by-one issues, suppose the signal is a complex oscillation at amplitude A, frequency n0. As a function of m = (1:N),
s(m) = A*e^(2*pi*i*n0*m/N) m = 1...N
The fft does the calculation
g(n) = Sum{m=1,N} s(m) e^(-2*pi*i*n*m/N) = Sum{m=1,N} A*e^(2*pi*i*(n0-n)*m/N)
If n~=n0, the sum is 0. If n=n0 you get N identical terms in the sum and g(n0) = A*N.
There is more than one way to normalize an fft, but if you want to get back the amplitude A, you need to divide by N.
The factor of 2 is boring by comparison. An fft spectrum has contributions at both positive and negative frequencies. For a real signal, those two contributions have the same size, as in
cos(2*pi*i*n0*m/N) = ( e^(+2*pi*i*n0*m/N) + e^(-2*pi*i*n0*m/N) ) / 2,
similarly for sine. So people take the absolute values of the fft at positive freqs, toss the negative frequencies, and multiply by a factor of 2 to make up for it and obtain the amplitude of the cosine wave. Good for plotting, really bad for doing anthing else.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!