fft vs nufft- scaling

21 views (last 30 days)
Nathan Bblanc
Nathan Bblanc on 5 Aug 2022
Commented: Nathan Bblanc on 7 Aug 2022
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

Accepted Answer

David Goodmanson
David Goodmanson on 6 Aug 2022
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 Comments
David Goodmanson
David Goodmanson on 6 Aug 2022
Edited: David Goodmanson on 6 Aug 2022
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.
Nathan Bblanc
Nathan Bblanc on 7 Aug 2022
Thanks again David

Sign in to comment.

More Answers (0)

Categories

Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!