/usr/share/freemat/toolbox/signal/ifftshift.m is in freemat-data 4.0-5build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | % IFFTSHIFT IFFTSHIFT Inverse Shift FFT Output
%
% Usage
%
% The ifftshift function shifts the DC component (zero-frequency)
% of the output from the center of the array back to the first position
% and iseffectively the inverse of fftshift. For vectors
% this means swapping the two halves of the vector. For matrices,
% the first and third quadrants are swapped. So on for N-dimensional
% arrays. The syntax for its use is
%
% y = ifftshift(x).
%
% Alternately, you can specify that only one dimension be shifted
%
% y = ifftshift(x,dim).
%
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function y = ifftshift(x,dim)
if (nargin > 1)
if (numel(dim) ~= 1 | dim ~= floor(dim(1)) | dim < 1)
error('dim must be a positive scalar integer');
end
shiftvec = zeros(1,dim);
shiftvec(dim) = floor(size(x,dim)/2);
else
shiftvec = floor(size(x)/2);
end
y = circshift(x,-shiftvec);
|