


SRFFT fft of a real symmetric spectrum X=(Y,N) Y is the "first half" of a symmetric real input signal and X is the "first half" of the symmetric real fourier transform. If the length, N, of the full signal is even, then the "first half" contains 1+N/2 elements (the first and last are excluded from the reflection). If N is odd, the "first half" conatins 0.5+N/2 elemnts and only the first is excluded from the reflection. If N is specified explicitly, then Y will be truncated of zero-padded accordingly. If N is omitted it will be taken to be 2*(length(Y)-1) and is always even. The inverse function is y=srfft(x,n)/n


0001 function x=srfft(y,n) 0002 %SRFFT fft of a real symmetric spectrum X=(Y,N) 0003 % Y is the "first half" of a symmetric real input signal and X is the 0004 % "first half" of the symmetric real fourier transform. 0005 % If the length, N, of the full signal is even, then the "first half" 0006 % contains 1+N/2 elements (the first and last are excluded from the reflection). 0007 % If N is odd, the "first half" conatins 0.5+N/2 elemnts and only the first 0008 % is excluded from the reflection. 0009 % If N is specified explicitly, then Y will be truncated of zero-padded accordingly. 0010 % If N is omitted it will be taken to be 2*(length(Y)-1) and is always even. 0011 % 0012 % The inverse function is y=srfft(x,n)/n 0013 0014 % Copyright (C) Mike Brookes 1998 0015 % Version: $Id: rsfft.m 713 2011-10-16 14:45:43Z dmb $ 0016 % 0017 % VOICEBOX is a MATLAB toolbox for speech processing. 0018 % Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html 0019 % 0020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0021 % This program is free software; you can redistribute it and/or modify 0022 % it under the terms of the GNU General Public License as published by 0023 % the Free Software Foundation; either version 2 of the License, or 0024 % (at your option) any later version. 0025 % 0026 % This program is distributed in the hope that it will be useful, 0027 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0028 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0029 % GNU General Public License for more details. 0030 % 0031 % You can obtain a copy of the GNU General Public License from 0032 % http://www.gnu.org/copyleft/gpl.html or by writing to 0033 % Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA. 0034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0035 0036 if ~isreal(y) error('SRFFT: Input must be real'); end 0037 fl=size(y,1)==1; 0038 if fl y=y(:); end 0039 [m,k]=size(y); 0040 if nargin<2 n=2*m-2; 0041 else 0042 mm=1+fix(n/2); 0043 if mm>m y=[y; zeros(mm-m,k)]; 0044 elseif mm<m y(mm+1:m,:)=[]; 0045 end 0046 m=mm; 0047 end 0048 x=real(fft([y;y(n-m+1:-1:2,:)])); 0049 x(m+1:end,:)=[]; 0050 0051 if fl x=x.'; end