# v_lpcar2rr

## PURPOSE V_LPCAR2RR Convert autoregressive coefficients to autocorrelation coefficients RR=(AR,P)

## SYNOPSIS function rr=v_lpcar2rr(ar,p)

## DESCRIPTION ```V_LPCAR2RR Convert autoregressive coefficients to autocorrelation coefficients RR=(AR,P)
The routine calculated the autocorrelation coefficients of the signal
that results from feeding unit-variance, zero-mean noise into the all-pole filter
Input:   ar(:,n+1)  Autoregressive coefficients including 0'th coefficient
Output:  rr(:,p+1)    Autocorrelation coefficients including 0'th order coefficient
If p is not specified it is taken to be n```

## CROSS-REFERENCE INFORMATION This function calls:
• v_lpcar2rf V_LPCAR2RF Convert autoregressive coefficients to reflection coefficients AR=(RF)
• v_lpcrf2rr V_LPCRR2AR convert reflection coefs to autocorrelation coefs [RR,AR]=(RF,P)
This function is called by:
• v_distchar V_DISTCHAR calculates the cosh spectral distance between AR coefficients D=(AR1,AR2,MODE)
• v_distisar V_DISTISAR calculates the Itakura-Saito distance between AR coefficients D=(AR1,AR2,MODE)
• v_distitar V_DISTITAR calculates the Itakura distance between AR coefficients D=(AR1,AR2,MODE)
• v_meansqtf V_AVEPSPEC calculates the mean square transfer function for a filter D=(B,A)

## SOURCE CODE ```0001 function rr=v_lpcar2rr(ar,p)
0002 %V_LPCAR2RR Convert autoregressive coefficients to autocorrelation coefficients RR=(AR,P)
0003 % The routine calculated the autocorrelation coefficients of the signal
0004 % that results from feeding unit-variance, zero-mean noise into the all-pole filter
0005 % Input:   ar(:,n+1)  Autoregressive coefficients including 0'th coefficient
0006 % Output:  rr(:,p+1)    Autocorrelation coefficients including 0'th order coefficient
0007 % If p is not specified it is taken to be n
0008
0009
0010 %      Copyright (C) Mike Brookes 1997
0011 %      Version: \$Id: v_lpcar2rr.m 10865 2018-09-21 17:22:45Z dmb \$
0012 %
0013 %   VOICEBOX is a MATLAB toolbox for speech processing.
0015 %
0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0017 %   This program is free software; you can redistribute it and/or modify
0019 %   the Free Software Foundation; either version 2 of the License, or
0020 %   (at your option) any later version.
0021 %
0022 %   This program is distributed in the hope that it will be useful,
0023 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0024 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0025 %   GNU General Public License for more details.
0026 %
0027 %   You can obtain a copy of the GNU General Public License from
0028 %   http://www.gnu.org/copyleft/gpl.html or by writing to
0029 %   Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA.
0030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0031
0032 k=ar(:,1).^(-2);
0033 if size(ar,2)==1
0034    rr=k;
0035 else
0036    if nargin>1
0037       rr=v_lpcrf2rr(v_lpcar2rf(ar),p).*k(:,ones(1,p+1));
0038    else
0039       rr=v_lpcrf2rr(v_lpcar2rf(ar)).*k(:,ones(1,size(ar,2)));
0040    end
0041 end```