现代数字信号处理及应用仿真题答案文档格式.docx
《现代数字信号处理及应用仿真题答案文档格式.docx》由会员分享,可在线阅读,更多相关《现代数字信号处理及应用仿真题答案文档格式.docx(17页珍藏版)》请在冰豆网上搜索。
M=length(w0);
N=length(u);
mu=0.005;
forn=M:
N
ui=u(n:
-1:
n-M+1);
y(n)=w'
*ui;
e(n)=d(n)-y(n);
w=w+mu.*conj(e(n)).*ui;
w1(n)=w
(1);
w2(n)=w
(2);
ee(:
i)=mean(e.^2,2);
end
ep=mean(ee'
);
plot(ep);
xlabel('
迭代次数'
ylabel('
MSE'
title('
学习曲线'
plot(w1);
hold;
plot(w2);
仿真结果:
步长0.015仿真结果
步长0.025仿真结果
步长0.005仿真结果
4.18程序
data_len=512;
%样本序列的长度
trials=100;
%随机试验的次数
A=zeros(data_len,2);
EA=zeros(data_len,1);
B=zeros(data_len,2);
EB=zeros(data_len,1);
form=1:
trials
a1=-0.975;
a2=0.95;
sigma_v_2=0.0731;
v=sqrt(sigma_v_2)*randn(data_len,1,trials);
%产生v(n)
u0=[00];
num=1;
den=[1a1a2];
Zi=filtic(num,den,u0);
%滤波器的初始条件
u=filter(num,den,v,Zi);
%产生样本序列u(n)
%
(2)用LMS滤波器来估计w1和w2
mu1=0.05;
mu2=0.005;
w1=zeros(2,data_len);
w2=zeros(2,data_len);
e1=zeros(data_len,1);
e2=zeros(data_len,1);
d1=zeros(data_len,1);
d2=zeros(data_len,1);
%LMS迭代过程
forn=3:
data_len-1
w1(:
n+1)=w1(:
n)+mu1*u(n-1:
-1:
n-2,:
m)*conj(e1(n));
w2(:
n+1)=w2(:
n)+mu2*u(n-1:
m)*conj(e2(n));
d1(n+1)=w1(:
n+1)'
*u(n:
n-1,:
m);
d2(n+1)=w2(:
e1(n+1)=u(n+1,:
m)-d1(n+1);
e2(n+1)=u(n+1,:
m)-d2(n+1);
A=A+conj(w1)'
;
EA=EA+e1.^2;
B=B+conj(w2)'
EB=EB+e2.^2;
%剩余均方误差和失调参数
wopt=zeros(2,trials);
Jmin=zeros(1,trials);
sum_eig=zeros(trials,1);
form=1:
trials;
rm=xcorr(u(:
:
m),'
biased'
R=[rm(512),rm(513);
rm(511),rm(512)];
p=[rm(511);
rm(510)];
wopt(:
m)=R\p;
[v,d]=eig(R);
Jmin(m)=rm(512)-p'
*wopt(:
m);
sum_eig(m)=d(1,1)+d(2,2);
sJmin=sum(Jmin)/trials;
e1_100trials_ave=sum(e1)/trials;
e2_100trials_ave=sum(e2)/trials;
Jex1=e1_100trials_ave-sJmin;
Jex2=e2_100trials_ave-sJmin;
sum_eig_100trials=sum(sum_eig)/100;
Jexfin=mu1*sJmin*(sum_eig_100trials/(2-mu1*sum_eig_100trials));
Jexfin2=mu2*sJmin*(sum_eig_100trials/(2-mu2*sum_eig_100trials));
M1=Jexfin/sJmin
M2=Jexfin2/sJmin
figure
(1);
plot(A/trials);
holdon;
plot(conj(w1)'
权向量'
步长为0.05权向量收敛曲线'
figure
(2);
plot(B/trials);
plot(conj(w2)'
步长为0.005权向量收敛曲线'
figure(3);
plot(EA/trials,'
*'
plot(EB/trials,'
-'
均方误差'
步长分别为0.05和0.005学习曲线'
仿真结果
失调参数
M1=0.0545M2=0.0052
4.19
程序
clearall
%产生观测信号和期望信号
%随机试验的次数
data_len=1000;
%样本数目
n=1:
data_len;
A1=zeros(data_len,2);
EA1=zeros(data_len,1);
fori=1:
sigma_v_2=0.5;
phi=2*pi*rand(1,1);
%随机相位
signal=sin(pi/2*n'
+phi);
%信号s(n)
u=signal+sqrt(sigma_v_2)*randn(data_len,1);
%观测信号u(n)
d=2*cos(pi/2*n'
%期望响应信号d(n)
%LMS迭代算法
mu=0.015;
M=2;
w=zeros(M,data_len);
e=zeros(data_len,1);
y=zeros(data_len,1);
form=2:
data_len-1
w(:
m+1)=w(:
m)+mu*u(m:
m-1)*conj(e(m));
y(m+1)=w(:
m+1)'
*u(m+1:
m);
e(m+1)=d(m+1)-y(m+1);
A1=A1+conj(w)'
EA1=EA1+e.^2;
plot(e);
单次实验学习曲线'
plot(EA1/trials);
100次独立试验学习曲线'
plot(A1/trials);
plot(conj(w)'
权向量收敛曲线'
5.10
(1)
(2)
(3) 特征值分解
eig(R2)=diag{0.4704,93.6270}
Eig(R3)=diag{0.3148,0.9362,139.8951}
特征值扩展:
X(R2)=199.0370
X(R3)=444.4107
(4)程序
L=10000;
sigma_v1=0.93627;
A1=zeros(L,2);
EA1=zeros(L,1);
100
v=sqrt(sigma_v1)*randn(L,1);
a1=-0.99;
u
(1)=v
(1);
fork=2:
L
u(k)=-a1*u(k-1)+v(k);
end
%u=u(500:
end);
M=2;
w(1,:
)=zeros(1,M);
e
(1)=u
(1);
mu=0.001;
uu=zeros(1,M);
w(2,:
)=w(1,:
)+mu*e
(1)*uu;
uu=[u
(1)uu(1:
M-1)];
dd=(w(2,:
)*uu'
)'
e
(2)=u
(2)-dd;
fork=3:
w(k,:
)=w(k-1,:
)+mu*e(k-1)*uu;
uu=[u(k-1)uu(1:
dd=(w(k,:
e(k)=u(k)-dd;
A1=A1+conj(w);
EA1=EA1+(e.^2)'
plot(EA1/100);
迭代500次,步长0.001'
plot(A1/100);
plot(conj(w));
5.11
1500
N=1000;
M=5;
L=2;
h=[0.38910