LPCAR2DB LPC: Convert AR coefs to power spectrum in dB DB=(AR) Inputs: ar(nf,n) AR coefficients, one frame per row np Size of output spectrum is np+1 [n] Outputs: db(nf,np+1) Power spectrum in dB from DC to Nyquist f(1,np+1) Normalized frequencies (0 to 0.5) For high speed make np equal to a power of 2

- rfft RFFT Calculate the DFT of real data Y=(X,N,D)

0001 function [db,f]=lpcar2db(ar,np) 0002 %LPCAR2DB LPC: Convert AR coefs to power spectrum in dB DB=(AR) 0003 % 0004 % Inputs: ar(nf,n) AR coefficients, one frame per row 0005 % np Size of output spectrum is np+1 [n] 0006 % 0007 % Outputs: db(nf,np+1) Power spectrum in dB from DC to Nyquist 0008 % f(1,np+1) Normalized frequencies (0 to 0.5) 0009 % 0010 % For high speed make np equal to a power of 2 0011 0012 0013 % Copyright (C) Mike Brookes 1998 0014 % Version: $Id: lpcar2db.m 5026 2014-08-22 17:47:43Z dmb $ 0015 % 0016 % VOICEBOX is a MATLAB toolbox for speech processing. 0017 % Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html 0018 % 0019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0020 % This program is free software; you can redistribute it and/or modify 0021 % it under the terms of the GNU General Public License as published by 0022 % the Free Software Foundation; either version 2 of the License, or 0023 % (at your option) any later version. 0024 % 0025 % This program is distributed in the hope that it will be useful, 0026 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0027 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0028 % GNU General Public License for more details. 0029 % 0030 % You can obtain a copy of the GNU General Public License from 0031 % http://www.gnu.org/copyleft/gpl.html or by writing to 0032 % Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA. 0033 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0034 0035 [nf,p1]=size(ar); 0036 if nargin<2 0037 if nargout 0038 np=p1-1; 0039 else 0040 np=128; 0041 end 0042 end 0043 ff=rfft(ar.',2*np).'; 0044 db=-10*log10(real(ff.*conj(ff))); 0045 f=(0:np)/(2*np); 0046 if ~nargout 0047 plot(f,db.'); 0048 xlabel('Normalized frequency f/f_s'); 0049 ylabel('LPC Power Spectrum (dB)'); 0050 end 0051

Generated on Tue 10-Oct-2017 08:30:10 by