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!