Sat 18 Jun 2011 02:59:41 PM UTC, comment #2:
I think the text box ate some of your comments because of mismatched verbatim tags. Here is what I think is the full text, reconstructed from the email notification I received:
I believe there could be a mistake in fftshift's documentation. It is claimed
that, after fftshift, the analog frequency vector is
where N is the number of samples and Dt is the time resolution.
Consider the case N = 6 and Dt = 1. The digital frequencies are
(The corresponding analog frequencies are the same, since Dt=1). As expected,
we see the Nyquist frequency (0.5). fftshift will arrange things so that the
FFT value corresponding to this frequency is aliased to -0.5. However, the
formula for f in fftshift's documentation produces:
This is incorrect, the 0.5 term was not aliased. The error can be
verified graphically by running:
where it will be clear that the spectrum is not symmetric around 0Hz. (See
also http://www.mathworks.com/matlabcentral/newsreader/view_thread/172590)
(By the way, the documented formula is correct for odd N). I believe a correct
formula for the frequencies is
where df=1/Dt. It may be expressed more succinctly, but I believe it is more
didactic expressed this way.
|