东南大学统计信号处理实验四.docx
《东南大学统计信号处理实验四.docx》由会员分享,可在线阅读,更多相关《东南大学统计信号处理实验四.docx(19页珍藏版)》请在冰豆网上搜索。
东南大学统计信号处理实验四
统计信号处理实验四
目的:
掌握自适应滤波的原理;
内容一:
假设一个接收到的信号为:
d(t)=s(t)+n(t),其中s(t)=A*cos(wt+a),已知信号的频率w=1KHz,而信号的幅度和相位未知,n(t)是一个服从N(0,1)分布的白噪声。
为了利用计算机对信号进行处理,将信号按10KHz的频率进行采样。
1)通过对
进行自适应信号处理,从接收信号中滤出有用信号
;
2)观察自适应信号处理的权系数;
3)观察在不同的收敛因子
下的滤波结果,并进行分析;
4)观察在不同的抽头数N下的滤波结果,并进行分析。
内容二:
在实验一的基础上,假设信号的频率也未知,重复实验一;
内容三:
假设s(t)是任意一个峰峰值不超过1的信号(取幅度为0.5的方波),n(t)是一个加在信号中的幅度和相位未知的,频率已知的50Hz单频干扰信号(可以假设幅度为1)。
信号取样频率1KHz,试通过自适应信号处理从接收信号中滤出有用信号s(t)。
要求:
1)给出自适应滤波器结构图;
2)设计仿真计算的Matlab程序,给出软件清单;
3)完成实验报告,对实验过程进行描述,并给出试验结果,对实验数据进行分析。
%LMS.m
function[yn,W,en]=LMS(xn,dn,M,mu,itr)
ifnargin==4
itr=length(xn);
elseifnargin==5
ifitr>length(xn)|itrerror('iterationsnumbererror!
');
end
else
error('checkparameter!
');
end
en=zeros(itr,1);
W=zeros(M,itr);
fork=M:
itr
x=xn(k:
-1:
k-M+1);
y=W(:
k-1).'*x;
en(k)=dn(k)-y;
W(:
k)=W(:
k-1)+2*mu*en(k)*x;
end
yn=inf*ones(size(xn));
fork=M:
length(xn)
x=xn(k:
-1:
k-M+1);
yn(k)=W(:
end).'*x;
end
内容一:
①
t=0:
999;
xs=10*sin(6.28*t/500);
figure;
subplot(2,1,1);
plot(t,xs);
grid;
ylabel('amplitude');
title('inputofperiodicsignal');
randn('state',sum(1000*clock));
xn=randn(1,1000);
subplot(2,1,2);
plot(t,xn);grid;
ylabel('amplitude');
xlabel('t');
title('randomnoisesignal');
xn=xs+xn;
xn=xn.';
dn=xs.';
M=5;
rho_max=max(eig(xn*xn.'));
mu=rand()*(1/rho_max);
[yn,W,en]=LMS(xn,dn,M,mu);
figure;
subplot(2,1,1);
plot(t,xn);grid;
ylabel('amplitude');
xlabel('t');
title('inputoffilter');
subplot(2,1,2);
plot(t,yn);grid;
ylabel('amplitude');
xlabel('t');
title('outputofadaptivefilter');
figure
plot(t,yn,'b',t,dn,'g',t,dn-yn,'r');grid;
legend('outputofadaptivefilter','expectedoutput','deviation');
ylabel('amplitude');
xlabel('t');
title('adaptivefilter');
②观察自适应信号处理的权系数
权系数非常小
③观察在不同的收敛因子
下的滤波结果,并进行分析
将收敛因子变大mu=rand()*(15/rho_max)
滤波效果变差
将收敛因子变小mu=rand()*(0.1/rho_max)
曲线变得平滑,误差大。
④观察在不同的抽头数N下的滤波结果,并进行分析。
M=5
M=10
M=30
抽头数越大,曲线月平滑,误差越大。
内容二:
t=0:
999;
xs=10*sin(6.28*t/500);
figure;
subplot(2,1,1);
plot(t,xs);
grid;
ylabel('amplitude');
title('inputofperiodicsignal');
randn('state',sum(1000*clock));
xn=randn(1,1000);
subplot(2,1,2);
plot(t,xn);grid;
ylabel('amplitude');
xlabel('t');
title('randomnoisesignal');
xn=xs+xn;
xn=xn.';
dn=xs.';
M=5;
rho_max=max(eig(xn*xn.'));
mu=rand()*(1/rho_max);
[yn,W,en]=LMS(xn,dn,M,mu);
figure;
subplot(2,1,1);
plot(t,xn);grid;
ylabel('amplitude');
xlabel('t');
title('inputoffilter');
subplot(2,1,2);
plot(t,yn);grid;
ylabel('amplitude');
xlabel('t');
title('outputofadaptivefilter');
figure
plot(t,yn,'b',t,dn,'g',t,dn-yn,'r');grid;
legend('outputofadaptivefilter','expectedoutput','deviation');
ylabel('amplitude');
xlabel('t');
title('adaptivefilter');
①
②权系数和内容一种类似
③mu=rand()*(15/rho_max)
mu=rand()*(0.1/rho_max)
④抽头数
M=5
M=20
M=30
内容三:
clear;
clc;
t=0:
999;
xs=0.5*square(6.28*t/500,50);
figure;
subplot(2,1,1);
plot(t,xs);grid;
ylabel('amplitude');
title('inputofperiodicsignal');
randn('state',sum(1000*clock));
xn=sin(314*t);
subplot(2,1,2);
plot(t,xn);grid;
ylabel('amplitude');
xlabel('t');
title('randomnoisesignal');
xn=xs+xn;
xn=xn.';
dn=xs.';
M=20;
rho_max=max(eig(xn*xn.'));
mu=rand()*(1/rho_max);
[yn,W,en]=LMS(xn,dn,M,mu);
figure;
subplot(2,1,1);
plot(t,xn);grid;
ylabel('amplitude');
xlabel('t');
title('inputoffilter');
subplot(2,1,2);
plot(t,yn);grid;
ylabel('amplitude');
xlabel('t');
title('outputofadaptivefilter');
figure
plot(t,yn,'b',t,dn,'g',t,dn-yn,'r');grid;
legend('outputofadaptivefilter','expectedoutput','deviation');
ylabel('amplitude');
xlabel('t');
title('adaptivefilte');