Home > voicebox > lpcar2rr.m

# lpcar2rr

## PURPOSE

LPCAR2RR Convert autoregressive coefficients to autocorrelation coefficients RR=(AR,P)

## SYNOPSIS

function rr=lpcar2rr(ar,p)

## DESCRIPTION

```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:
• lpcar2rf LPCAR2RF Convert autoregressive coefficients to reflection coefficients AR=(RF)
• lpcrf2rr LPCRR2AR convert reflection coefs to autocorrelation coefs [RR,AR]=(RF,P)
This function is called by:
• distchar DISTCHAR calculates the cosh spectral distance between AR coefficients D=(AR1,AR2,MODE)
• distisar DISTISAR calculates the Itakura-Saito distance between AR coefficients D=(AR1,AR2,MODE)
• distitar DISTITAR calculates the Itakura distance between AR coefficients D=(AR1,AR2,MODE)
• meansqtf AVEPSPEC calculates the mean square transfer function for a filter D=(B,A)

## SOURCE CODE

```0001 function rr=lpcar2rr(ar,p)
0002 %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: lpcar2rr.m 713 2011-10-16 14:45:43Z 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=lpcrf2rr(lpcar2rf(ar),p).*k(:,ones(1,p+1));
0038    else
0039       rr=lpcrf2rr(lpcar2rf(ar)).*k(:,ones(1,size(ar,2)));
0040    end
0041 end```

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