?? mmax_apa.m
字號(hào):
function [e,w] = Mmax_apa(x,d,N,M,K,w0,mu,epsilon,optsel)
% ----------------
% input parameters
% ----------------
% x : Lx1 input signal
% d : Lx1 desired response
% N : filter length
% M : number of coefficients to be updated
% K : APA order
% w0 : Nx1 initialization
% mu : step-size parameter
% epsilon : regularization parameter (to avoid divide by zero)
% optsel : 0 for simplified coefficient selection, 1 for optimal
% coefficient selection
% ----------------
% function outputs
% ----------------
% e : Lx1 output error vector
% w : LxN adaptive coefficient vectors
x = x(:);
d = d(:);
w0 = w0(:);
L = length(x);
w = zeros(L,N);
e = zeros(L,1);
w(1,:) = w0';
xvec = zeros(N,1);
X = zeros(K,N);
dvec = zeros(K,1);
for i = 1:L-1
xvec = [x(i);xvec(1:N-1)];
X = [xvec';X(1:K-1,:)];
e(i) = d(i)-w(i,:)*xvec;
dvec = [d(i);dvec(1:K-1)];
evec = dvec - X*w(i,:)';
upd = mu*X'*inv(epsilon*eye(K)+X*X')*evec;
if optsel == 1,
[xs,ix] = sort(-abs(upd)); %optimal M-max selection
else
[xs,ix] = sort(-sum(X.^2,1)); %simplified approximation
end
de = zeros(1,N);
de(ix(1:M)) = 1;
IM = diag(de);
upd = IM*upd;
w(i+1,:) = w(i,:) + upd';
end
xvec = [x(L);xvec(1:N-1)];
e(L) = d(L)-w(L,:)*xvec;
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -