Home > voicebox > rsfft.m

rsfft

PURPOSE ^

RSFFT fft of a real symmetric spectrum X=(Y,N)

SYNOPSIS ^

function x=rsfft(y,n)

DESCRIPTION ^

RSFFT    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 elements 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.

 If Y is a matrix, the transform is performed along each column

 The inverse function is y=rsfft(x,n)/n

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function x=rsfft(y,n)
0002 %RSFFT    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 elements 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 % If Y is a matrix, the transform is performed along each column
0013 %
0014 % The inverse function is y=rsfft(x,n)/n
0015 
0016 % Could be made faster for even n by using symmetry
0017 
0018 %      Copyright (C) Mike Brookes 1998
0019 %      Version: $Id: rsfft.m 5024 2014-08-22 17:05:55Z dmb $
0020 %
0021 %   VOICEBOX is a MATLAB toolbox for speech processing.
0022 %   Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html
0023 %
0024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0025 %   This program is free software; you can redistribute it and/or modify
0026 %   it under the terms of the GNU General Public License as published by
0027 %   the Free Software Foundation; either version 2 of the License, or
0028 %   (at your option) any later version.
0029 %
0030 %   This program is distributed in the hope that it will be useful,
0031 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0032 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0033 %   GNU General Public License for more details.
0034 %
0035 %   You can obtain a copy of the GNU General Public License from
0036 %   http://www.gnu.org/copyleft/gpl.html or by writing to
0037 %   Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA.
0038 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0039 
0040 if ~isreal(y) error('RSFFT: Input must be real'); end
0041 fl=size(y,1)==1;
0042 if fl y=y(:); end
0043 [m,k]=size(y);
0044 if nargin<2 n=2*m-2;
0045 else
0046     mm=1+fix(n/2);
0047     if mm>m y=[y; zeros(mm-m,k)];
0048     elseif mm<m y(mm+1:m,:)=[];
0049     end
0050     m=mm;
0051 end
0052 x=real(fft([y;y(n-m+1:-1:2,:)]));
0053 x(m+1:end,:)=[];
0054 if fl x=x.'; end

Generated on Tue 19-Sep-2017 12:07:31 by m2html © 2003