# v_lpcar2pf

## PURPOSE

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

## SYNOPSIS

function [pf,f]=v_lpcar2pf(ar,np)

## DESCRIPTION

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

      Inputs: ar(nf,n)     AR coefficients, one frame per row
              np           Size of output spectrum is np+1 [n]

     Outputs: pf(nf,np+1)  Power spectrum from DC to Nyquist
              f(1,np+1)    Normalized frequencies (0 to 0.5)

     For high speed make np equal to a power of 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,f]=v_lpcar2pf(ar,np)
    0002 %V_LPCAR2PF Convert AR coefs to power spectrum PF=(AR,NP)
    0003 %
    0004 %  Inputs: ar(nf,n)     AR coefficients, one frame per row
    0005 %          np           Size of output spectrum is np+1 [n]
    0006 %
    0007 % Outputs: pf(nf,np+1)  Power spectrum from DC to Nyquist
    0008 %          f(1,np+1)    Normalized frequencies (0 to 0.5)
    0009 %
    0010 % For high speed make np equal to a power of 2
    0011
    0012 %      Copyright (C) Mike Brookes 1998-2014
    0013 %      Version: $Id: v_lpcar2pf.m 10865 2018-09-21 17:22:45Z dmb $
    0014 %
    0015 %   VOICEBOX is a MATLAB toolbox for speech processing.
    0016 %   Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html
    0017 %
    0018 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    0019 %   This program is free software; you can redistribute it and/or modify
    0020 %   it under the terms of the GNU Lesser General Public License as published by
    0021 %   the Free Software Foundation; either version 3 of the License, or
    0022 %   (at your option) any later version.
    0023 %
    0024 %   This program is distributed in the hope that it will be useful,
    0025 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
    0026 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0027 %   GNU Lesser General Public License for more details.
    0028 %
    0029 %   You can obtain a copy of the GNU Lesser General Public License from
    0030 %   https://www.gnu.org/licenses/ .
    0031 %
    0032 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    0033
    0034 [nf,p1]=size(ar);
    0035 if nargin<2
    0036     if nargout
    0037         np=p1-1;
    0038     else
    0039         np=128;
    0040     end
    0041 end
    0042 pf=abs(v_rfft(ar.',2*np).').^(-2);
    0043 f=(0:np)/(2*np);
    0044 if ~nargout
    0045         plot(f,pf.');
    0046         xlabel('Normalized frequency f/f_s');
    0047         ylabel('LPC Power Spectrum');
    0048 end
    0049