%% Inverse Shift Vector Elements
% You can use the fftshift and ifftshift functions to swap left and right halves of a vector.
% Create a vector containing an odd number of elements, and swap the left and right sides of the vector using the fftshift function.

V = [1 2 3 4 5 6 7];
X = fftshift(V)

%
% Use the ifftshift function to swap the left and right sides of X. The result is the same as the original vector V.

Y = ifftshift(X)

%
% Calling the fftshift function twice does not necessarily reconstruct the original input.

fftshift(fftshift(V))

% Copyright 2012 The MathWorks, Inc.