summaryrefslogtreecommitdiff
path: root/macros/fftshift1.sci
diff options
context:
space:
mode:
Diffstat (limited to 'macros/fftshift1.sci')
-rw-r--r--macros/fftshift1.sci21
1 files changed, 21 insertions, 0 deletions
diff --git a/macros/fftshift1.sci b/macros/fftshift1.sci
index 2928850..d8721cd 100644
--- a/macros/fftshift1.sci
+++ b/macros/fftshift1.sci
@@ -1,4 +1,25 @@
function y= fftshift1(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.
+//Calling Sequence
+// fftshift1 (X)
+// fftshift1 (X, DIM)
+//Parameters
+//X:It is a vector of N elements corresponding to time samples
+//DIM: The optional DIM argument can be used to limit the dimension along which the permutation occurs
+//Description
+//This is an Octave function.
+//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 by dt, then 'fftshift1 (fft (X))' corresponds to frequencies
+//
+//f = [ -(ceil((N-1)/2):-1:1)*df 0 (1:floor((N-1)/2))*df ]
+//
+//where df = 1 / 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.
rhs= argn(2);
if(rhs <1 | rhs >2)
error('Wrong number of Input arguments');