我编了一个用自适应维纳FIR滤波器消除脑电波中的干扰
你们看看,这是我毕社的一个程序
clear
clc
n=0:1:100; %采样点数
N=5; %FIR 滤波器的阶数
n1=sin(n*pi/3); % 60HZ的噪声源
n2=0.5*sin(n*pi/3+rand*pi);%经噪声路径滤波器后的噪声
x1=rand(1,length(n));%-0.2—+0.2随机信号的产生
x=2*(x1-0.5)/5;
y=x+n2; %混杂的信号
g=length(y);
H=zeros(N,g);
T1=zeros(1,N);
u=1/(norm(n1*n1')); %调整系数
e=zeros(1,g); %存放滤波后信号初始的向量
for k=1:g %处理信号
for i=1:N-1
T1(i)=T1(i+1);
end
T1(N)=n1(k);
y1(k)=T1*H(:,k);
e(k)=y(k)-y1(k);
H(:,k+1)=H(:,k)+2*u*e(k)*T1';
end
N1=100;
figure(1)
subplot(2,1,1)
plot(y)
axis([ 1 N1 -0.7 0.7])
axis auto'x'
title('干扰后的信号')
subplot(2,1,2)
plot(e)
axis([ 1 N1-1 -0.7 0.7])
axis auto'x'
hold on
subplot(2,1,2)
plot(x,'r')
title('滤波后的信号与原始信号对比')
axis([1 N1-1 -0.7 0.7])
axis auto'x'
figure(2)
plot(H(1,')
title('一个权系数收敛情况')
clear
clc
n=0:1:100; %采样点数
N=5; %FIR 滤波器的阶数
n1=sin(n*pi/3); % 60HZ的噪声源
n2=0.5*sin(n*pi/3+rand*pi);%经噪声路径滤波器后的噪声
x1=rand(1,length(n));%-0.2—+0.2随机信号的产生
x=2*(x1-0.5)/5;
y=x+n2; %混杂的信号
g=length(y);
H=zeros(N,g);
T1=zeros(1,N);
u=1/(norm(n1*n1')); %调整系数
e=zeros(1,g); %存放滤波后信号初始的向量
for k=1:g %处理信号
for i=1:N-1
T1(i)=T1(i+1);
end
T1(N)=n1(k);
y1(k)=T1*H(:,k);
e(k)=y(k)-y1(k);
H(:,k+1)=H(:,k)+2*u*e(k)*T1';
end
N1=100;
figure(1)
subplot(2,1,1)
plot(y)
axis([ 1 N1 -0.7 0.7])
axis auto'x'
%title('滤波后信号与原始信号.前面.的对比')
title('干扰后的信号')
%hold on
%plot(t1(2,:),'r')
%axis([ 1 N1 -0.7 0.7])
%axis auto'x'
subplot(2,1,2)
plot(e)
%plot(t1(3,:),'b')
%title('滤波后的信号')
axis([ 1 N1-1 -0.7 0.7])
axis auto'x'
hold on
subplot(2,1,2)
plot(x,'r')
title('滤波后的信号与原始信号对比')
axis([1 N1-1 -0.7 0.7])
axis auto'x'
%figure(2)
%hold on
%plot(t1(4,:),'r')
%title('滤波后信号与原始信号.后面.的对比')
figure(2)
%plot(nk1)
%subplot(2,1,2)
plot(H(1,:)')
title('一个权系数收敛情况')
chenxu(2).rar_FIR滤波器_FIR维纳滤波_MATLAB脑电波_脑电_脑电波
版权申诉
5星 · 超过95%的资源 27 浏览量
2022-09-21
03:34:07
上传
评论 1
收藏 1KB RAR 举报
朱moyimi
- 粉丝: 65
- 资源: 1万+
最新资源
- 基于Javascript和Python的微商城项目设计源码 - MicroMall
- 基于Java的网上订餐系统设计源码 - online ordering system
- 基于Javascript的超级美眉网络资源管理应用模块设计源码
- 基于Typescript和PHP的编程知识储备库设计源码 - study-php
- Screenshot_2024-05-28-11-40-58-177_com.tencent.mm.jpg
- 基于Dart的Flutter小提琴调音器APP设计源码 - violinhelper
- 基于JavaScript和CSS的随寻订购网页设计源码 - web-order
- 基于MATLAB的声纹识别系统设计源码 - VoiceprintRecognition
- 基于Java的微服务插件集合设计源码 - wsy-plugins
- 基于Vue和微信小程序的监理日志系统设计源码 - supervisionLog
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈