Home > voicebox > rfft.m

# rfft

## PURPOSE

RFFT Calculate the DFT of real data Y=(X,N,D)

## SYNOPSIS

function y=rfft(x,n,d)

## DESCRIPTION

```RFFT     Calculate the DFT of real data Y=(X,N,D)
Data is truncated/padded to length N if specified.
N even:    (N+2)/2 points are returned with
the first and last being real
N odd:    (N+1)/2 points are returned with the
first being real
In all cases fix(1+N/2) points are returned
D is the dimension along which to do the DFT```

## CROSS-REFERENCE INFORMATION

This function calls:
This function is called by:
• fxrapt FXRAPT RAPT pitch tracker [FX,VUV]=(S,FS,M,Q)
• lpcar2db LPCAR2DB LPC: Convert AR coefs to power spectrum in dB DB=(AR)
• lpcar2ff LPCAR2FF LPC: Convert AR coefs to complex spectrum FF=(AR,NP)
• lpcar2pf LPCAR2PF Convert AR coefs to power spectrum PF=(AR,NP)
• lpccc2db LPCCC2DB Convert complex cepstrum to dB power spectrum DB=(CC,NP,NC)
• lpccc2ff LPCCC2FF Convert complex cepstrum to complex spectrum FF=(CC,NP,NC)
• lpccc2pf LPCCC2PF Convert complex cepstrum to power spectrum PF=(CC,NP,NC)
• lpcra2pf LPCAR2PF Convert AR coefs to power spectrum PF=(RA,NP)
• melcepst MELCEPST Calculate the mel cepstrum of a signal C=(S,FS,W,NC,P,N,INC,FL,FH)
• modspect MODSPECT Calculate the modulation spectrum of a signal C=(S,FS,W,NC,P,N,INC,FL,FH)
• sigalign SIGALIGN align a clean reference with a noisy signal [d,g,rr,ss]=(s,r,maxd,m,fs)
• specsub SPECSUB performs speech enhancement using spectral subtraction [SS,ZO]=(S,FSZ,P)
• specsubm SPECSUBM obsolete speech enhancement algorithm - use specsub instead
• spendred SPENDRED Speech Enhancement and Dereverberation by Doire
• spgrambw SPGRAMBW Draw spectrogram [T,F,B]=(s,fs,mode,bw,fmax,db,tinc,ann)
• ssubmmse SSUBMMSE performs speech enhancement using mmse estimate of spectral amplitude or log amplitude [SS,ZO]=(S,FSZ,PP)
• ssubmmsev SSUBMMSE performs speech enhancement using mmse estimate of spectral amplitude or log amplitude [SS,ZO]=(S,FSZ,P)
• v_windinfo WINDINFO window information and figures of merit X=(W,FS)

## SOURCE CODE

```0001 function y=rfft(x,n,d)
0002 %RFFT     Calculate the DFT of real data Y=(X,N,D)
0003 % Data is truncated/padded to length N if specified.
0004 %   N even:    (N+2)/2 points are returned with
0005 %             the first and last being real
0006 %   N odd:    (N+1)/2 points are returned with the
0007 %             first being real
0008 % In all cases fix(1+N/2) points are returned
0009 % D is the dimension along which to do the DFT
0010
0011
0012
0013 %      Copyright (C) Mike Brookes 1998
0014 %      Version: \$Id: rfft.m 713 2011-10-16 14:45:43Z dmb \$
0015 %
0016 %   VOICEBOX is a MATLAB toolbox for speech processing.
0018 %
0019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0020 %   This program is free software; you can redistribute it and/or modify
0022 %   the Free Software Foundation; either version 2 of the License, or
0023 %   (at your option) any later version.
0024 %
0025 %   This program is distributed in the hope that it will be useful,
0026 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0027 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0028 %   GNU General Public License for more details.
0029 %
0030 %   You can obtain a copy of the GNU General Public License from
0031 %   http://www.gnu.org/copyleft/gpl.html or by writing to
0032 %   Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA.
0033 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0034
0035 s=size(x);
0036 if prod(s)==1
0037     y=x
0038 else
0039     if nargin <3 || isempty(d)
0040         d=find(s>1,1);
0041         if nargin<2
0042             n=s(d);
0043         end
0044     end
0045     if isempty(n)
0046         n=s(d);
0047     end
0048     y=fft(x,n,d);
0049     y=reshape(y,prod(s(1:d-1)),n,prod(s(d+1:end)));
0050     s(d)=1+fix(n/2);
0051     y(:,s(d)+1:end,:)=[];
0052     y=reshape(y,s);
0053 end```

Generated on Mon 06-Aug-2018 14:48:32 by m2html © 2003