# v_lpcrr2ar

## PURPOSE

V_LPCRR2AR convert autocorrelation coefs to ar coefs [AR,E]=(RR)

## SYNOPSIS

function [ar,e]=v_lpcrr2ar(rr);

## DESCRIPTION

    V_LPCRR2AR convert autocorrelation coefs to ar coefs [AR,E]=(RR)
    E is the residual energy

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

## SOURCE CODE

    0001 function [ar,e]=v_lpcrr2ar(rr);
    0002 %V_LPCRR2AR convert autocorrelation coefs to ar coefs [AR,E]=(RR)
    0003 %E is the residual energy
    0004
    0005 % could test e each time and remove rows when it gets small
    0006
    0007
    0008 %      Copyright (C) Mike Brookes 1997
    0009 %      Version: $Id: v_lpcrr2ar.m 10865 2018-09-21 17:22:45Z dmb $
    0010 %
    0011 %   VOICEBOX is a MATLAB toolbox for speech processing.
    0012 %   Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html
    0013 %
    0014 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    0015 %   This program is free software; you can redistribute it and/or modify
    0016 %   it under the terms of the GNU Lesser General Public License as published by
    0017 %   the Free Software Foundation; either version 3 of the License, or
    0018 %   (at your option) any later version.
    0019 %
    0020 %   This program is distributed in the hope that it will be useful,
    0021 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
    0022 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0023 %   GNU Lesser General Public License for more details.
    0024 %
    0025 %   You can obtain a copy of the GNU Lesser General Public License from
    0026 %   https://www.gnu.org/licenses/ .
    0027 %
    0028 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    0029
    0030 [nf,p1]=size(rr);
    0031 p=p1-1;
    0032 ar=ones(nf,p1);
    0033 ar(:,2) = -rr(:,2)./rr(:,1);
    0034 e = rr(:,1).*(ar(:,2).^2-1);
    0035 for n = 2:p
    0036    k = (rr(:,n+1)+sum(rr(:,n:-1:2).*ar(:,2:n),2)) ./ e;
    0037    ar(:,2:n) = ar(:,2:n)+k(:,ones(1,n-1)).*ar(:,n:-1:2);
    0038    ar(:,n+1) = k;
    0039    e = e.*(1-k.^2);
    0040 end
    0041 e=-e;