V_LPCAR2LS convert ar polynomial to line spectrum pair frequencies LS=(AR) output vector elements will be in range 0 to 0.5 the returned vector will be of length p
0001 function ls=v_lpcar2ls(ar) 0002 %V_LPCAR2LS convert ar polynomial to line spectrum pair frequencies LS=(AR) 0003 % output vector elements will be in range 0 to 0.5 0004 % the returned vector will be of length p 0005 0006 % This routine is nowhere near as efficient as it might be 0007 0008 0009 % Copyright (C) Mike Brookes 1997 0010 % Version: $Id: v_lpcar2ls.m 10865 2018-09-21 17:22:45Z dmb $ 0011 % 0012 % VOICEBOX is a MATLAB toolbox for speech processing. 0013 % Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html 0014 % 0015 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0016 % This program is free software; you can redistribute it and/or modify 0017 % it under the terms of the GNU General Public License as published by 0018 % the Free Software Foundation; either version 2 of the License, or 0019 % (at your option) any later version. 0020 % 0021 % This program is distributed in the hope that it will be useful, 0022 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0023 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0024 % GNU General Public License for more details. 0025 % 0026 % You can obtain a copy of the GNU General Public License from 0027 % http://www.gnu.org/copyleft/gpl.html or by writing to 0028 % Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA. 0029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0030 0031 [nf,p1]=size(ar); 0032 p = p1-1; 0033 p2 = fix(p/2); 0034 d=0.5/pi; 0035 0036 if rem(p,2) % odd order 0037 for k=1:nf 0038 aa=[ar(k,:) 0]; 0039 r = aa + fliplr(aa); 0040 q = aa - fliplr(aa); 0041 fr = sort(angle(roots(r))); 0042 fq = [sort(angle(roots(deconv(q,[1 0 -1])))); 0]; 0043 f = [fr(p2+2:p+1).' ; fq(p2+1:p).']; 0044 f(p+1) = []; 0045 ls(k,:) = d*f(:).'; 0046 end 0047 else 0048 for k=1:nf 0049 aa=[ar(k,:) 0]; 0050 r = aa + fliplr(aa); 0051 q = aa - fliplr(aa); 0052 fr = sort(angle(roots(deconv(r,[1 1])))); 0053 fq = sort(angle(roots(deconv(q,[1 -1])))); 0054 f = [fr(p2+1:p).' ; fq(p2+1:p).']; 0055 ls(k,:) = d*f(:).'; 0056 end 0057 end