Thu 25 Jul 2013 01:31:41 PM UTC, original submission:
As far as I understand, that is how interpft is working when the input
is a real array (I will speak only of a 1D array):
- take the discrete Fourier transform (DFT) of the array,
- zero-pad the transformed array, the zeroes being in the middle, so
as to preserve the usual symmetry properties of the DFT,
- inverse DFT of the zero-padded array.
When the length, N, of the initial vector is even, there is only one
element of the DFTed array which corresponds to the Nyquist frequency
(both the negative and positive Nyquist values are real and equal).
When zero-padding, Octave chooses to keep its associated value in the
negative range. To illustrate, simply take the DFT of the result, to
see the zero-padded array that Octave builds:
fft( interpft([1 2 3 4], 6) )'
15.00000 - 0.00000i
-3.00000 - 3.00000i
-0.00000 - 0.00000i
0.00000 - 0.00000i
-3.00000 - 0.00000i <<<< Nyquist
-3.00000 + 3.00000i
Matlab chooses instead to take half of the value associated to the
Nyquist frequency and to put it both in the positive and the negative
range:
15.0000
-3.0000 - 3.0000i
-1.5000 <<<< positive Nyquist
0
-1.5000 <<<< negative Nyquist
-3.0000 + 3.0000i
I find Matlab choice more elegant since the zero-padded array has the
usual symmetry properties: zero frequency alone, negative frequencies
complex conjugate of positive frequencies. However, the real parts of
the results of interpft are identical for Octave and Matlab, so I
would not really qualify this as a bug.
When the length, N, of the initial vector is odd, then there is a
positive and a negative Nyquist (complex conjugate of one another),
and there should be no choice for the zero-padded array. Matlab
operates in the intuitive way:
Octave, instead, puts the positive Nyquist in the negative range, next
to the negative Nyquist:
This choice is more crucial, because, in addition of the loosing of
the above mentioned symmetry, the result is different:
Matlab:
Octave:
If this is a conscious choice of Octave, it seems to me that it should
be mentioned in the documentation.
|