fft vs nufft- scaling

15 visualizaciones (últimos 30 días)
Nathan Bblanc
Nathan Bblanc el 5 de Ag. de 2022
Comentada: Nathan Bblanc el 7 de Ag. de 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

Respuesta aceptada

David Goodmanson
David Goodmanson el 6 de Ag. de 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 comentarios
David Goodmanson
David Goodmanson el 6 de Ag. de 2022
Editada: David Goodmanson el 6 de Ag. de 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 el 7 de Ag. de 2022
Thanks again David

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Fourier Analysis and Filtering en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by