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!