Home > voicebox > lpcra2pf.m

# lpcra2pf

## PURPOSE

LPCAR2PF Convert AR coefs to power spectrum PF=(RA,NP)

## SYNOPSIS

function pf=lpcra2pf(ra,np)

## DESCRIPTION

```LPCAR2PF Convert AR coefs to power spectrum PF=(RA,NP)
The routine is faster if NP+1 is a power of 2
For RA(:,p+1) the default value of np is p and the output is PF(:,p+2)```

## CROSS-REFERENCE INFORMATION

This function calls:
• rfft RFFT Calculate the DFT of real data Y=(X,N,D)
This function is called by:

## SOURCE CODE

```0001 function pf=lpcra2pf(ra,np)
0002 %LPCAR2PF Convert AR coefs to power spectrum PF=(RA,NP)
0003 % The routine is faster if NP+1 is a power of 2
0004 % For RA(:,p+1) the default value of np is p and the output is PF(:,p+2)
0005
0006
0007 %      Copyright (C) Mike Brookes 1997
0008 %      Version: \$Id: lpcra2pf.m 713 2011-10-16 14:45:43Z dmb \$
0009 %
0010 %   VOICEBOX is a MATLAB toolbox for speech processing.
0012 %
0013 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0014 %   This program is free software; you can redistribute it and/or modify
0016 %   the Free Software Foundation; either version 2 of the License, or
0017 %   (at your option) any later version.
0018 %
0019 %   This program is distributed in the hope that it will be useful,
0020 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0021 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0022 %   GNU General Public License for more details.
0023 %
0024 %   You can obtain a copy of the GNU General Public License from
0025 %   http://www.gnu.org/copyleft/gpl.html or by writing to
0026 %   Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA.
0027 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0028
0029 [nf,p1]=size(ra);
0030 if nargin<2 np=p1-1; end
0031 pp=2*np+2;
0032 if pp>=2*p1
0033    pf=abs(rfft([ra zeros(nf,pp-2*p1+1) ra(:,p1:-1:2)].').').^(-1);
0034 else
0035    pf=abs(rfft([ra(:,1:np+2) ra(:,np+1:-1:2)].').').^(-1);
0036 end
0037```

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