?? nlms_chinliang_wang.m
字號:
function e_prediction=nlms_chinliang_wang(receive_signal,num_weight,N_user)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%由Chin-Liang Wang提出的自適應非線性反饋補償濾波器抑制多用戶情況下的窄帶干擾。
%e_prediction=nlms_chinliang_wang(receive_signal,num_weight,a,N_user)
%receive_signal: 為接收信號序列=s+i+n;
%e_prediction: 為預測到的信號值
%num_weight: 抽頭系數個數;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
z=receive_signal;
M=length(z);
w=0.001*randn(1,num_weight)'; %tap weight
e=zeros(1,M); %prediction/subtract error
e_hat=zeros(1,M);
z_hat=zeros(1,M); %predictive value of the narrowband interference
z_tilde=zeros(1,M); %predictive value of the narrowband interference with the offset compensation
z_bar=zeros(1,M); %input signal of the compensated filter
% z_tilde=z; %input signal of the predictor
b=zeros(1,M);
d=0.001*randn(1,M); %output signal of the compensated filter
p=zeros(1,M); %the recursive estimated value of the power of the tap delay signal
% delta=zeros(1,M); %variance of the e(k)
% sgmak2=zeros(1,M); %the variance of the leave term of interference and thermol noise
pe=zeros(1,M); %quantizative error
u=0.1; %convergence factor
% belta=0.0025; %forget factor
% delta(num_weight)=2;
p(num_weight)=5;%norm(z(1:num_weight))^2;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for k=(num_weight+1):M
X=z_bar(k-1:-1:k-num_weight).';
B=b(k-1:-1:k-num_weight).';
z_hat(k)=w'*X;
d(k)=w'*B;
z_tilde(k)=z_hat(k)+d(k);
e(k)=z(k)-z_hat(k);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% delta(k)=(1-belta)*delta(k-1)+abs(e(k))^2*belta;
% sgmak2(k)=delta(k)-1;
% pe(k)=e(k)-tanh(e(k)/(sgmak2(k)+0.01)); %軟判決
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
z_bar(k)=z(k)-multiquantizer(e(k),N_user);
e_hat(k)=z_bar(k)-z_hat(k);
b(k)=z_bar(k)-z_tilde(k);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Update the tap weight
xk2=norm(X)^2;
% p(k)=p(k-1)+u*(xk2-p(k-1)); %選擇一:傳統功率遞歸
gama=0.1; %選擇二:采用另外的遺忘因子
p(k)=(1-gama)*p(k-1)+gama*xk2;
w=w+u/(p(k)+10)*e_hat(k)*X;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
e_prediction=e;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -