Thu 30 Jun 2011 08:56:26 PM UTC, original submission:
fftshift requires a second argument that specifies the dimension along which the shift is to be made, even if the first argumwent is a one-dimensional array (i.e., vector). This behavior does not match the documentation (and is inconsistent with MATLAB) which indicates that fftshift may be called with a single argument.
Transcript:
octave:1> fftshift([1 2 3 4])
error: fftshift: A(I): index out of bounds; value 4 out of bound 1
error: called from:
error: /usr/share/octave/3.4.0/m/signal/fftshift.m at line 70, column 14
octave:1> fftshift([1 2 3 4],1)
ans =
1 2 3 4
octave:2> fftshift([1 2 3 4],2)
ans =
3 4 1 2
octave:3> fftshift([1 2 3 4]')
error: fftshift: A(I): index out of bounds; value 4 out of bound 1
error: called from:
error: /usr/share/octave/3.4.0/m/signal/fftshift.m at line 70, column 14
octave:3> fftshift([1 2 3 4]',1)
ans =
3
4
1
2
octave:4> fftshift([1 2 3 4]',2)
ans =
1
2
3
4
octave:5> help fftshift
`fftshift' is a function from the file /usr/share/octave/3.4.0/m/signal/fftshift.m
-- Function File: fftshift (X)
-- Function File: fftshift (X, DIM)
Perform a shift of the vector X, for use with the `fft' and `ifft'
functions, in order the move the frequency 0 to the center of the
vector or matrix.
If X is a vector of N elements corresponding to N time samples
spaced of Dt each, then `fftshift (fft (X))' corresponds to
frequencies
f = ((1:N) - ceil(N/2)) / N / Dt
If X is a matrix, the same holds for rows and columns. If X is an
array, then the same holds along each dimension.
The optional DIM argument can be used to limit the dimension along
which the permutation occurs.
Additional help for built-in functions and operators is
available in the on-line version of the manual. Use the command
`doc <topic>' to search the manual index.
Help and information about Octave is also available on the WWW
at http://www.octave.org and via the -unavailable-
mailing list.
|