# v_lpcra2pf

## PURPOSE

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

## SYNOPSIS

function pf=v_lpcra2pf(ra,np)

## DESCRIPTION

    V_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:

- v_rfft V_RFFT Calculate the DFT of real data Y=(X,N,D)

This function is called by:

## SOURCE CODE

    0001 function pf=v_lpcra2pf(ra,np)
    0002 %V_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: v_lpcra2pf.m 10865 2018-09-21 17:22:45Z dmb $
    0009 %
    0010 %   VOICEBOX is a MATLAB toolbox for speech processing.
    0011 %   Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html
    0012 %
    0013 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    0014 %   This program is free software; you can redistribute it and/or modify
    0015 %   it under the terms of the GNU Lesser General Public License as published by
    0016 %   the Free Software Foundation; either version 3 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 Lesser General Public License for more details.
    0023 %
    0024 %   You can obtain a copy of the GNU Lesser General Public License from
    0025 %   https://www.gnu.org/licenses/ .
    0026 %
    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(v_rfft([ra zeros(nf,pp-2*p1+1) ra(:,p1:-1:2)].').').^(-1);
    0034 else
    0035    pf=abs(v_rfft([ra(:,1:np+2) ra(:,np+1:-1:2)].').').^(-1);
    0036 end
    0037