⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fftshift1.m

📁 阵列信号处理的工具箱
💻 M
字号:
function Xout = fftshift1(Xin, invShift)%FFTSHIFT1 Shift DC component to or from center of spectrum for several 1D spektra.%%  For vectors, FFTSHIFT1(X) swaps the left and right halves of%  X.  For matrices, FFTSHIFT1(X) swaps the upper and lower halves.%  Note, for matrices FFTSHIFT1 differs from FFTSHIFT.%%  FFTSHIFT1 is useful for visualizing several 1D Fourier transform with%  the DC component in the middle of the spectrum.%%  FFTSHIFT1 is simliar to the Matlab function FFTSHIFT but not the same.%  FFTSHIFT works on a 2D spektra and FFTSHIFT1 on several 1D spektra.%%  FFTSHIFT1(X,'inv') also swaps the halves of X but should be used%  before IFFT is used. The DC component is shifted from the center of the%  spectrum to the ends, suitable as input to IFFT.%%See also FFTSHIFT, FFT.%   *  DBT, A Matlab Toolbox for Radar Signal Processing  *% (c) FOA 1994-2000. See the file dbtright.m for copyright notice.%%  Start        : 980714 Svante Bj鰎klund (svabj).%  Latest change: $Date: 2000/10/16 15:20:57 $ $Author: svabj $.%  $Revision: 1.4 $% *****************************************************************************if nargin < 2  invShift = '';end%ifsx = size(Xin);if (min(sx) == 1)	% A vector.  len = max(sx);  Xin = Xin(:);  if ((rem(len,2) == 0)) % Even number.    Xout = [Xin(len/2+1:len); Xin(1:len/2)];  else 		 % Odd number.    if (strcmp(invShift,'inv'))      centerIx = floor(len/2);    else      centerIx = ceil(len/2);    end%if      Xout = [Xin(centerIx+1:len);Xin(1:centerIx)];  end%if  if (sx(2) > 1)    Xout = Xout.';  end%ifelse			% A matrix.  len = sx(1);  if ((rem(len,2) == 0)) % Even number.    Xout = [Xin(len/2+1:len,:); Xin(1:len/2,:)];  else 			 % Odd number.    if (strcmp(invShift,'inv'))      centerIx = floor(len/2);    else      centerIx = ceil(len/2);    end%if    Xout = [Xin(centerIx+1:len,:);Xin(1:centerIx,:)];  end%ifend%if

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -