⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lpcfit2.m

📁 非常好的数字处理教程
💻 M
字号:
function [a,e] = lpcfit(x,p,w,h)% [a,e] = lpcfit(x,p,w,h)  Fit LPC to short-time segments%    x is a stretch of signal.  Using w point windows every %    h points, fit order p LPC models.  Return the successive %    all-pole coefficients as rows of a, and the residual excitation %    in e.% 2001-02-25 dpwe@ee.columbia.eduif nargin < 2  p = 12;endif nargin < 3  w = 256;endif nargin < 4  h = w/2;endnpts = length(x);nhops = 1 + floor((npts-w)/h);a = zeros(nhops, p+1);e = zeros(1, npts);% Pre-emphasispre = [1 -0.9];x = filter(pre,1,x);for hop = 1:nhops  % Extract segment of signal  xx = x((hop - 1)*h + [1:w]);  if max(xx)==0 & min(xx) == 0      xx(1) = 0.1;  end  % Apply hanning window  wxx = xx .* hanning(w);  % Form autocorrelation (calculates *way* too many points)  rxx = xcorr(wxx,wxx);  % extract just the points we need (middle p+1 points)  rxx = rxx(w+[0:p]);  % Setup the normal equations  R = toeplitz(rxx(1:p));  % Solve for a (horribly inefficient to use full inv())  an = inv(R)*rxx(2:(p+1));  % Calculate residual by filtering xx (after windowing?)  % rs = filter([1 -an'],1,xx);  rs = filter([1 -an'],1,wxx);  G = sqrt(mean(rs.^2));  % Save them; first column is residual MSE (gain)  a(hop,:) = [G -an'];  e((hop - 1)*h + [(1+h/2):(w-h/2)]) = rs([(1+h/2):(w-h/2)])/G;  end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -