clc
clear
beta1=5;
lamda=0.998;
Wg=128;
h=randn(Wg,1);h=h/sqrt(sum(h.^2));
NN=80000+Wg;
delta=0.001;
MSE_PNLMS=zeros(NN,1);
runs=10;
for run=1:runs
run
xk=sqrt(1)*randn(NN,1);
y=filter(h,1,xk);
vn=0.1*randn(NN,1);
dnoise=y+vn;
%%%%%%%initialization of PNLMS
en=0;
ev=0;
ex=0;
ed=0;
W_PNLMS=zeros(Wg,1);
e_PNLMS=zeros(NN,1);
rex=zeros(Wg,1);
mu_PNLMS=1;
red=0;
%%%%%%%%%%%
for k=Wg:40128
X=[xk(k:-1:k-Wg+1)];
%%%%%%%%%PNLMS
e_PNLMS(k)=dnoise(k)-(W_PNLMS')*X;
en=lamda*en+(1-lamda)*e_PNLMS(k)^2;
en1=sqrt(en);
ed=lamda*ed+(1-lamda)*dnoise(k)^2;
rex=lamda*rex+(1-lamda)*X*e_PNLMS(k);
red=lamda*red+(1-lamda)*dnoise(k)*e_PNLMS(k);
ex=lamda*ex+(1-lamda)*xk(k)^2;
ev=en-(1/ex)*rex'*rex;
mu_PNLMS1=1;
test=(red-en)/(ed-red);
if abs((red-en)/(ed-red))<0.35
mu_PNLMS=lamda*mu_PNLMS+(1-lamda)*en/(beta1*ev);
mu_PNLMS1=mu_PNLMS;
end
W_PNLMS=W_PNLMS+mu_PNLMS1/(delta+X'*X)*X*e_PNLMS(k);
MSE_PNLMS(k)=MSE_PNLMS(k)+(W_PNLMS-h)'*(W_PNLMS-h);
%PNLMS
end
h1=h*(-1);
y=filter(h1,1,xk);
% h1(13:Wg)=h(1:Wg-12);
% h1(1:12)=zeros(12,1);
% y=filter(h1,1,xk);
vn=0.1*randn(NN,1);
dnoise=y+vn;
mu_PNLMS=1;
for k=40129:NN
X=[xk(k:-1:k-Wg+1)];
%%%%PNLMS
e_PNLMS(k)=dnoise(k)-(W_PNLMS')*X;
en=lamda*en+(1-lamda)*e_PNLMS(k)^2;
en1=sqrt(en);
ed=lamda*ed+(1-lamda)*dnoise(k)^2;
rex=lamda*rex+(1-lamda)*X*e_PNLMS(k);
red=lamda*red+(1-lamda)*dnoise(k)*e_PNLMS(k);
ex=lamda*ex+(1-lamda)*xk(k)^2;
ev=en-(1/ex)*rex'*rex;
mu_PNLMS1=1;
test=(red-en)/(ed-red);
if abs((red-en)/(ed-red))<0.35
mu_PNLMS=lamda*mu_PNLMS+(1-lamda)*en/(beta1*ev);
mu_PNLMS1=mu_PNLMS;
end
W_PNLMS=W_PNLMS+mu_PNLMS1/(delta+X'*X)*X*e_PNLMS(k);
MSE_PNLMS(k)=MSE_PNLMS(k)+(W_PNLMS-h1)'*(W_PNLMS-h1);
%PNLMS
end
end
a=linspace(0,10,80000);
MSE_PNLMS=MSE_PNLMS/runs;
MSE_PNLMS=10*log10(MSE_PNLMS(Wg+1:NN));
plot(a,MSE_PNLMS)
clear
beta1=15;
lamda=0.998;
Wg=128;
h=randn(Wg,1);h=h/sqrt(sum(h.^2));
NN=80000+Wg;
delta=0.001;
MSE_PNLMS=zeros(NN,1);
runs=10;
for run=1:runs
run
xk=sqrt(1)*randn(NN,1);
y=filter(h,1,xk);
vn=0.1*randn(NN,1);
dnoise=y+vn;
%%%%%%%initialization of PNLMS
en=0;
ev=0;
ex=0;
ed=0;
W_PNLMS=zeros(Wg,1);
e_PNLMS=zeros(NN,1);
rex=zeros(Wg,1);
mu_PNLMS=1;
red=0;
%%%%%%%%%%%
for k=Wg:40128
X=[xk(k:-1:k-Wg+1)];
%%%%%%%%%PNLMS
e_PNLMS(k)=dnoise(k)-(W_PNLMS')*X;
en=lamda*en+(1-lamda)*e_PNLMS(k)^2;
en1=sqrt(en);
ed=lamda*ed+(1-lamda)*dnoise(k)^2;
rex=lamda*rex+(1-lamda)*X*e_PNLMS(k);
red=lamda*red+(1-lamda)*dnoise(k)*e_PNLMS(k);
ex=lamda*ex+(1-lamda)*xk(k)^2;
ev=en-(1/ex)*rex'*rex;
mu_PNLMS1=1;
test=(red-en)/(ed-red);
if abs((red-en)/(ed-red))<0.35
mu_PNLMS=lamda*mu_PNLMS+(1-lamda)*en/(beta1*ev);
mu_PNLMS1=mu_PNLMS;
end
W_PNLMS=W_PNLMS+mu_PNLMS1/(delta+X'*X)*X*e_PNLMS(k);
MSE_PNLMS(k)=MSE_PNLMS(k)+(W_PNLMS-h)'*(W_PNLMS-h);
%PNLMS
end
h1=h*(-1);
y=filter(h1,1,xk);
% h1(13:Wg)=h(1:Wg-12);
% h1(1:12)=zeros(12,1);
% y=filter(h1,1,xk);
vn=0.1*randn(NN,1);
dnoise=y+vn;
mu_PNLMS=1;
for k=40129:NN
X=[xk(k:-1:k-Wg+1)];
%%%%PNLMS
e_PNLMS(k)=dnoise(k)-(W_PNLMS')*X;
en=lamda*en+(1-lamda)*e_PNLMS(k)^2;
en1=sqrt(en);
ed=lamda*ed+(1-lamda)*dnoise(k)^2;
rex=lamda*rex+(1-lamda)*X*e_PNLMS(k);
red=lamda*red+(1-lamda)*dnoise(k)*e_PNLMS(k);
ex=lamda*ex+(1-lamda)*xk(k)^2;
ev=en-(1/ex)*rex'*rex;
mu_PNLMS1=1;
test=(red-en)/(ed-red);
if abs((red-en)/(ed-red))<0.35
mu_PNLMS=lamda*mu_PNLMS+(1-lamda)*en/(beta1*ev);
mu_PNLMS1=mu_PNLMS;
end
W_PNLMS=W_PNLMS+mu_PNLMS1/(delta+X'*X)*X*e_PNLMS(k);
MSE_PNLMS(k)=MSE_PNLMS(k)+(W_PNLMS-h1)'*(W_PNLMS-h1);
%PNLMS
end
end
a=linspace(0,10,80000);
MSE_PNLMS=MSE_PNLMS/runs;
MSE_PNLMS=10*log10(MSE_PNLMS(Wg+1:NN));
hold on
plot(a,MSE_PNLMS,'r')
clear
beta1=30;
lamda=0.998;
Wg=128;
h=randn(Wg,1);h=h/sqrt(sum(h.^2));
NN=80000+Wg;
delta=0.001;
MSE_PNLMS=zeros(NN,1);
runs=10;
for run=1:runs
run
xk=sqrt(1)*randn(NN,1);
y=filter(h,1,xk);
vn=0.1*randn(NN,1);
dnoise=y+vn;
%%%%%%%initialization of PNLMS
en=0;
ev=0;
ex=0;
ed=0;
W_PNLMS=zeros(Wg,1);
e_PNLMS=zeros(NN,1);
rex=zeros(Wg,1);
mu_PNLMS=1;
red=0;
%%%%%%%%%%%
for k=Wg:40128
X=[xk(k:-1:k-Wg+1)];
%%%%%%%%%PNLMS
e_PNLMS(k)=dnoise(k)-(W_PNLMS')*X;
en=lamda*en+(1-lamda)*e_PNLMS(k)^2;
en1=sqrt(en);
ed=lamda*ed+(1-lamda)*dnoise(k)^2;
rex=lamda*rex+(1-lamda)*X*e_PNLMS(k);
red=lamda*red+(1-lamda)*dnoise(k)*e_PNLMS(k);
ex=lamda*ex+(1-lamda)*xk(k)^2;
ev=en-(1/ex)*rex'*rex;
mu_PNLMS1=1;
test=(red-en)/(ed-red);
if abs((red-en)/(ed-red))<0.35
mu_PNLMS=lamda*mu_PNLMS+(1-lamda)*en/(beta1*ev);
mu_PNLMS1=mu_PNLMS;
end
W_PNLMS=W_PNLMS+mu_PNLMS1/(delta+X'*X)*X*e_PNLMS(k);
MSE_PNLMS(k)=MSE_PNLMS(k)+(W_PNLMS-h)'*(W_PNLMS-h);
%PNLMS
end
h1=h*(-1);
y=filter(h1,1,xk);
% h1(13:Wg)=h(1:Wg-12);
% h1(1:12)=zeros(12,1);
% y=filter(h1,1,xk);
vn=0.1*randn(NN,1);
dnoise=y+vn;
mu_PNLMS=1;
for k=40129:NN
X=[xk(k:-1:k-Wg+1)];
%%%%PNLMS
e_PNLMS(k)=dnoise(k)-(W_PNLMS')*X;
en=lamda*en+(1-lamda)*e_PNLMS(k)^2;
en1=sqrt(en);
ed=lamda*ed+(1-lamda)*dnoise(k)^2;
rex=lamda*rex+(1-lamda)*X*e_PNLMS(k);
red=lamda*red+(1-lamda)*dnoise(k)*e_PNLMS(k);
ex=lamda*ex+(1-lamda)*xk(k)^2;
ev=en-(1/ex)*rex'*rex;
mu_PNLMS1=1;
test=(red-en)/(ed-red);
if abs((red-en)/(ed-red))<0.35
mu_PNLMS=lamda*mu_PNLMS+(1-lamda)*en/(beta1*ev);
mu_PNLMS1=mu_PNLMS;
end
W_PNLMS=W_PNLMS+mu_PNLMS1/(delta+X'*X)*X*e_PNLMS(k);
MSE_PNLMS(k)=MSE_PNLMS(k)+(W_PNLMS-h1)'*(W_PNLMS-h1);
%PNLMS
end
end
a=linspace(0,10,80000);
MSE_PNLMS=MSE_PNLMS/runs;
MSE_PNLMS=10*log10(MSE_PNLMS(Wg+1:NN));
hold on
plot(a,MSE_PNLMS,'k')
clear
beta1=50;
lamda=0.998;
Wg=128;
h=randn(Wg,1);h=h/sqrt(sum(h.^2));
NN=80000+Wg;
delta=0.001;
MSE_PNLMS=zeros(NN,1);
runs=10;
for run=1:runs
run
xk=sqrt(1)*randn(NN,1);
y=filter(h,1,xk);
vn=0.1*randn(NN,1);
dnoise=y+vn;
%%%%%%%initialization of PNLMS
en=0;
ev=0;
ex=0;
ed=0;
W_PNLMS=zeros(Wg,1);
e_PNLMS=zeros(NN,1);
rex=zeros(Wg,1);
mu_PNLMS=1;
red=0;
%%%%%%%%%%%
for k=Wg:40128
X=[xk(k:-1:k-Wg+1)];
%%%%%%%%%PNLMS
e_PNLMS(k)=dnoise(k)-(W_PNLMS')*X;
en=lamda*en+(1-lamda)*e_PNLMS(k)^2;
en1=sqrt(en);
ed=lamda*ed+(1-lamda)*dnoise(k)^2;
rex=lamda*rex+(1-lamda)*X*e_PNLMS(k);
red=lamda*red+(1-lamda)*dnoise(k)*e_PNLMS(k);
ex=lamda*ex+(1-lamda)*xk(k)^2;
ev=en-(1/ex)*rex'*rex;
mu_PNLMS1=1;
test=(red-en)/(ed-red);
if abs((red-en)/(ed-red))<0.35
mu_PNLMS=lamda*mu_PNLMS+(1-lamda)*en/(beta1*ev);
评论3