现代数字信号处理及其应用 第六章仿真题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
6.12
clc;
clear;
M=15;
Lb=10;
% hb=[0.407 0.815 0.407];
hb=[0.04 -0.05 0.07 -0.21 -0.5 0.72 0.36 0 0.21 0.03 0.07]; Hb=zeros(2*M+1,2*M+Lb+1);
for k=1:2*M+1
Hb(k,k:1:k+Lb)=hb;
end
EA1 = zeros(2000, 1);
EA2 = zeros(2000, 1);
for k=1:100
sigma=1e-3;
N=2000;
s=randsrc(2*M+Lb+N,1);
vn=sqrt(sigma)*randn(2*M+N,1);
S=zeros(2*M+Lb+1,N);
V=zeros(2*M+1,N);
for k=1:N
S(:,k)=s(2*M+Lb+k:-1:k);
V(:,k)=vn(2*M+k:-1:k);
end
Ub=Hb*S+V;
errb_LMS=zeros(N,1);
wb_LMS=zeros(2*M+1,N);
wb_LMS(M+1,1)=1;
dn=S(M+Lb+1,:);
errb_LMS(1)=dn(1)-wb_LMS(:,1)'*Ub(:,1);
mu=0.025;
for k=1:N-1
wb_LMS(:,k+1)=wb_LMS(:,k)+mu*Ub(:,k)*conj(errb_LMS(k)); errb_LMS(k+1)=dn(k+1)-wb_LMS(:,k+1)'*Ub(:,k+1);
end
MSEb_LMS=abs(errb_LMS).^2;
EA1=EA1+MSEb_LMS;
lambda=0.99;
delta=0.004;
wb_RLS=zeros(2*M+1,N+1);
wb_RLS(M+1,1)=1;
epsilon=zeros(N,1);
P1=eye(2*M+1)/delta;
for k=1:N
PIn=P1*Ub(:,k);
deno=lambda+Ub(:,k)'*PIn;
kn=PIn/deno;
epsilon(k)=dn(k)-wb_RLS(:,k)'*Ub(:,k);
wb_RLS(:,k+1)=wb_RLS(:,k)+kn*conj(epsilon(k)); P1=P1/lambda-kn*Ub(:,k)'*P1/lambda;
end
MSEb_RLS=abs(epsilon).^2;
EA2=EA2+MSEb_RLS;
end
M=15;
Lb=2;
hb=[0.407 0.815 0.407];
Hb=zeros(2*M+1,2*M+Lb+1);
for k=1:2*M+1
Hb(k,k:1:k+Lb)=hb;
end
EA3 = zeros(2000, 1);
EA4 = zeros(2000, 1);
for k=1:100
sigma=1e-3;
N=2000;
s=randsrc(2*M+Lb+N,1);
vn=sqrt(sigma)*randn(2*M+N,1);
S=zeros(2*M+Lb+1,N);
V=zeros(2*M+1,N);
for k=1:N
S(:,k)=s(2*M+Lb+k:-1:k);
V(:,k)=vn(2*M+k:-1:k);
end
Ub=Hb*S+V;
errb_LMS=zeros(N,1);
wb_LMS=zeros(2*M+1,N);
wb_LMS(M+1,1)=1;
dn=S(M+Lb+1,:);
errb_LMS(1)=dn(1)-wb_LMS(:,1)'*Ub(:,1);
mu=0.025;
for k=1:N-1
wb_LMS(:,k+1)=wb_LMS(:,k)+mu*Ub(:,k)*conj(errb_LMS(k)); errb_LMS(k+1)=dn(k+1)-wb_LMS(:,k+1)'*Ub(:,k+1);
end
MSEb_LMS=abs(errb_LMS).^2;
EA3=EA3+MSEb_LMS;
lambda=0.99;
delta=0.004;
wb_RLS=zeros(2*M+1,N+1);
wb_RLS(M+1,1)=1;
epsilon=zeros(N,1);
P1=eye(2*M+1)/delta;
for k=1:N
PIn=P1*Ub(:,k);
deno=lambda+Ub(:,k)'*PIn;
kn=PIn/deno;
epsilon(k)=dn(k)-wb_RLS(:,k)'*Ub(:,k);
wb_RLS(:,k+1)=wb_RLS(:,k)+kn*conj(epsilon(k));
P1=P1/lambda-kn*Ub(:,k)'*P1/lambda;
end
MSEb_RLS=abs(epsilon).^2;
EA4=EA4+MSEb_RLS;
end
% figure
plot(EA1/100);
hold on
plot(EA2/100);
hold on
plot(EA3/100);
hold on
plot(EA4/100);
6.15
clc;
clear;
EA1 = zeros(999, 1);
A1 = zeros(2, 1000);
for i=1:100
a1=0.99;
sigma=0.995;
N=1000;
vn=sqrt(sigma)*randn(N,1);
nume=1;
deno=[1 a1];
u0=zeros(length(deno)-1,1);
xic=filtic(nume,deno,u0);
un=filter(nume,deno,vn,xic);
n0=1;
M=2;
b=un(n0+1:N);
L=length(b);
un1=[zeros(M-1,1).',un.'];
A=zeros(M,L);
for k=1:L
A(:,k)=un1(M-1+k:-1:k);
end
delta=0.004;
lambda=0.98;
w=zeros(M,L+1);
epsilon=zeros(L,1);
P1=eye(M)/delta;
for k=1:L
PIn=P1*A(:,k);
denok=lambda+A(:,k)'*PIn;
kn=PIn/denok;
epsilon(k)=b(k)-w(:,k)'*A(:,k);
w(:,k+1)=w(:,k)+kn*conj(epsilon(k)); P1=P1/lambda-kn*A(:,k)'*P1/lambda; end
MSE=abs(epsilon).^2;
EA1=EA1+MSE;
A1=A1+w;
end
plot(EA1/100);
A2=A1/500;
plot(A2(1,:));。