现代数字信号处理及应用仿真题答案.docx
- 文档编号:29833689
- 上传时间:2023-07-27
- 格式:DOCX
- 页数:20
- 大小:181.19KB
现代数字信号处理及应用仿真题答案.docx
《现代数字信号处理及应用仿真题答案.docx》由会员分享,可在线阅读,更多相关《现代数字信号处理及应用仿真题答案.docx(20页珍藏版)》请在冰豆网上搜索。
现代数字信号处理及应用仿真题答案
仿真作业
姓名:
***
学号:
S*********
4.17程序
clc;
clear;
fori=1:
500
sigma_v1=0.27;
b
(1)=-0.8458;
b
(2)=0.9458;
a
(1)=-(b
(1)+b
(2));
a
(2)=b
(1)*b
(2);
datlen=500;
rand('state',sum(100*clock));
s=sqrt(sigma_v1)*randn(datlen,1);
x=filter(1,[1,a],s);
%%
sigma_v2=0.1;
u=x+sqrt(sigma_v2)*randn(datlen,1);
d=filter(1,[1,-b
(1)],s);
%%
w0=[1;0];
w=w0;
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
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:
-1:
n-2,:
m)*conj(e2(n));
d1(n+1)=w1(:
n+1)'*u(n:
-1:
n-1,:
m);
d2(n+1)=w2(:
n+1)'*u(n:
-1:
n-1,:
m);
e1(n+1)=u(n+1,:
m)-d1(n+1);
e2(n+1)=u(n+1,:
m)-d2(n+1);
end
A=A+conj(w1)';
EA=EA+e1.^2;
B=B+conj(w2)';
EB=EB+e2.^2;
end
%剩余均方误差和失调参数
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);
end
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)');
xlabel('迭代次数');ylabel('权向量');title('步长为0.05权向量收敛曲线');
figure
(2);
plot(B/trials);holdon;
plot(conj(w2)');
xlabel('迭代次数');ylabel('权向量');title('步长为0.005权向量收敛曲线');
figure(3);
plot(EA/trials,'*');holdon;
plot(EB/trials,'-');
xlabel('迭代次数');ylabel('均方误差');title('步长分别为0.05和0.005学习曲线');
仿真结果
失调参数
M1=0.0545M2=0.0052
4.19
程序
clearall
%产生观测信号和期望信号
trials=100;%随机试验的次数
data_len=1000;%样本数目
n=1:
data_len;
A1=zeros(data_len,2);
EA1=zeros(data_len,1);
fori=1:
trials
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'+phi);%期望响应信号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:
-1:
m-1)*conj(e(m));
y(m+1)=w(:
m+1)'*u(m+1:
-1:
m);
e(m+1)=d(m+1)-y(m+1);
end
A1=A1+conj(w)';
EA1=EA1+e.^2;
end
figure
(1);
plot(e);
xlabel('迭代次数');ylabel('均方误差');title('单次实验学习曲线');
figure
(2);
plot(EA1/trials);
xlabel('迭代次数');ylabel('均方误差');title('100次独立试验学习曲线');
figure(3);
plot(A1/trials);holdon;
plot(conj(w)');
xlabel('迭代次数');ylabel('权向量');title('权向量收敛曲线');
仿真结果:
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)程序
clearall
clc;
L=10000;
sigma_v1=0.93627;
A1=zeros(L,2);
EA1=zeros(L,1);
fori=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:
L
w(k,:
)=w(k-1,:
)+mu*e(k-1)*uu;
uu=[u(k-1)uu(1:
M-1)];
dd=(w(k,:
)*uu')';
e(k)=u(k)-dd;
end
A1=A1+conj(w);
EA1=EA1+(e.^2)';
end
figure
(1);
plot(EA1/100);
xlabel('迭代次数');ylabel('均方误差');title('迭代500次,步长0.001');
figure
(2);
plot(A1/100);holdon;
plot(conj(w));
xlabel('迭代次数');ylabel('权向量');title('权向量收敛曲线');
5.11
clearall
clear;
clc;
fori=1:
1500
N=1000;
M=5;
L=2;
h=[0.38910.389];
sigma=1e-3;
vn=sqrt(sigma)*randn(2*M+N,1);
H=zeros(2*M+1,2*M+L+1);
fork=1:
2*M+1
H(k,k:
1:
k+L)=h;
end
s=randsrc(2*M+L+N,1);
S=zeros(2*M+L+1,N);
V=zeros(2*M+1,N);
fork=1:
N
S(:
k)=s(2*M+L+k:
-1:
k);
V(:
k)=vn(2*M+k:
-1:
k);
end
U=H*S+V;
dn=S(M+L+1,:
);
if(i<=500)
mu=0.01;
elseif(i>500&&i<=1000)
mu=0.025;
else
mu=0.05;
end
a=size(U);
M=a
(1);
N=a
(2);
err=zeros(N,1);
w=zeros(M,N);
w((M-1)/2+1,1)=1;
err
(1)=dn
(1)-w(:
1)'*U(:
1);
fork=1:
N-1
w(:
k+1)=w(:
k)+mu*U(:
k)*conj(err(k));
err(k+1)=dn(k+1)-w(:
k+1)'*U(:
k+1);
end
if(i<=500)
ee1(:
i)=mean(abs(err).^2,2);
elseif(i>500&&i<=1000)
ee2(:
i)=mean(abs(err).^2,2);
else
ee3(:
i)=mean(abs(err).^2,2);
end
end
ep1=mean(ee1');
ep2=mean(ee2');
ep3=mean(ee3');
figure
(1);
plot(ep1);
holdon;
plot(ep2);
holdon;
plot(ep3)
xlabel('µü´ú´ÎÊý');ylabel('¾ù·½Îó²î');
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 现代 数字信号 处理 应用 仿真 答案
![提示](https://static.bdocx.com/images/bang_tan.gif)