📄 earplms.m
字号:
function [a] = earplms(Y, p, UC);
% [a] = earplms(Y, p, UC);
% earplms Estimate Coefficients of AR-Process
% Y(t)-a*Y(t-1) = E(t)
% using the Least Mean Square method
%
%Input: Y Signal
% p model order
% UC step size parameter (default 0.01/var{Y})
%Output:
% a AR-Parameters
% Version 2.30
% last revision 21.03.1998
% Copyright (c) 1997, 1998 by Alois Schloegl
% e-mail: a.schloegl@ieee.org
% This library is free software; you can redistribute it and/or
% modify it under the terms of the GNU Library General Public
% License as published by the Free Software Foundation; either
% Version 2 of the License, or (at your option) any later version.
%
% This library is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
% Library General Public License for more details.
%
% You should have received a copy of the GNU Library General Public
% License along with this library; if not, write to the
% Free Software Foundation, Inc., 59 Temple Place - Suite 330,
% Boston, MA 02111-1307, USA.
ly = size(Y);
if ~sum(ly <= 1)
error('Must be a vector.')
end
ly = max(ly);
if diff(ly)>0
Y = Y'; % Make sure it's a row vector
end;
a=zeros(p,ly);
if nargin < 3
UC=0.01/var(Y);
end;
for i=2:p,
e = Y(i) - Y(i-1:-1:1) * a(1:i-1,i-1);
a(1:i-1,i) = a(1:i-1,i-1) + (UC * e) * Y(i-1:-1:1)';
end;
for i=p+1:ly,
e = Y(i) - Y(i-1:-1:i-p) * a(:,i-1);
a(:,i) = a(:,i-1) + (UC * e) * Y(i-1:-1:i-p)';
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -