V_LPCAR2RF Convert autoregressive coefficients to reflection coefficients AR=(RF) Input: ar(:,p+1) Autoregressive coefficients Output: rf(:,p+1) Reflection coefficients with rf(:,1)=1
0001 function rf=v_lpcar2rf(ar) 0002 %V_LPCAR2RF Convert autoregressive coefficients to reflection coefficients AR=(RF) 0003 % 0004 % Input: ar(:,p+1) Autoregressive coefficients 0005 % Output: rf(:,p+1) Reflection coefficients with rf(:,1)=1 0006 0007 0008 % Copyright (C) Mike Brookes 1997 0009 % Version: $Id: v_lpcar2rf.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 General Public License as published by 0017 % the Free Software Foundation; either version 2 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 General Public License for more details. 0024 % 0025 % You can obtain a copy of the GNU General Public License from 0026 % http://www.gnu.org/copyleft/gpl.html or by writing to 0027 % Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA. 0028 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0029 0030 [nf,p1] = size(ar); 0031 if p1==1 0032 rf=ones(nf,1); 0033 else 0034 if any(ar(:,1)~=1) 0035 ar=ar./ar(:,ones(1,p1)); 0036 end 0037 rf = ar; 0038 for j = p1-1:-1:2 0039 k = rf(:,j+1); 0040 d = (1-k.^2).^(-1); 0041 wj=ones(1,j-1); 0042 rf(:,2:j) = (rf(:,2:j)-k(:,wj).*rf(:,j:-1:2)).*d(:,wj); 0043 end 0044 end 0045