clc;
clear all;
close all;
N=1000;%系统采样点数
f1 = 200; %信号的频率
t = (0:N-1);
fd = 48000; %采样率
Fs=fd;
t1 = 0:1/fd:(N-1)/fd;
s = 1*sin(2*pi*f1*t1);%正弦波信号原始信号
%% 产生均值为0方差为0.1的噪声信号
v = sqrt(0.1)*randn(N,1); %白噪声
%% 模拟干扰噪声信道
H1 = [1,-0.8,0.4,-0.2]; %噪声源至有用信号的信道
xn = filter(H1,1,v);
d1 = s+v';
dn = d1';
figure(1);
subplot(4,1,1);
plot(t,s);grid;ylim([-2 2]);
ylabel('幅度');
xlabel('时间');
title('原始信号');
subplot(4,1,2);
plot(t,v);grid;xlim([0 1000]);ylim([-2 2]);
ylabel('幅度');
xlabel('时间');
title('噪声信号');
subplot(4,1,3);
plot(t,d1);grid;ylim([-2 2]);
ylabel('幅度');
xlabel('时间');
title ('含噪信号');
%% LMS滤波算法
M = 16; %滤波器阶数M
mu = 0.04; %滤波器的步长
[ylms,W,elms] = LMS (xn,dn,M,mu);
%[ylms,W,elms] = LMS_VS (xn,dn,M,mu);
%% 绘制去噪后的语音信号
subplot(4,1,4);
plot(t,elms);grid;ylim([-2,2]);
ylabel('幅度');
xlabel('时间');
title ('去噪后的信号');
audiowrite('去噪音频.wav',elms,Fs);
%%
e = s'-elms;%剩余噪声
figure(2);
subplot(4,1,1);
plot(t,e);grid;
ylabel('幅度');
xlabel('时间');
title('剩余噪声');
N = length(s);
n1=-N/2:N/2-1;
%f=n1*Fs/N;
figure;
%t=n1/Fs;
fft_y=fft(s);
fftshift_y=fftshift(fft_y);
f=linspace(-Fs/2,Fs/2,N);
subplot(3,1,1);
plot(f,abs(fftshift_y));
title('原始信号频谱');
fft_y1=fft(dn);
fftshift_y1=fftshift(fft_y1);
f=linspace(-Fs/2,Fs/2,N);
subplot(3,1,2);
plot(f,abs(fftshift_y1));
title('含噪信号频谱');
fft_y2=fft(elms);
fftshift_y2=fftshift(fft_y2);
f=linspace(-Fs/2,Fs/2,N);
subplot(3,1,3);
plot(f,abs(fftshift_y2));
title('降噪后信号频谱');
[snr0,snr1]=SNR_FUNC(s',dn,elms);
fprintf('自适应滤波算法降噪前信噪比=:%d \n',snr0);
fprintf('自适应滤波算法降噪后信噪比=:%d \n',snr1);

一坨牛马
- 粉丝: 172
最新资源
- 基于PLC的电梯控制系统研究与方案设计书.doc
- 《网络安全》复习题.doc
- 互联网的企业信息交易平台的研究与研究与设计开发.doc
- 银行计算机网络风险的分析与对策.docx
- VB酒店服务管理完整.doc
- 科学大数据的发展态势及建议.docx
- 云计算时代网络安全现状与防御措施探讨.docx
- 在地铁5G网络建设过程中的规划需求分析.docx
- 区块链分布式记账应用会计记账领域探究.docx
- 《数据库课程设计方案》任务.doc
- 网络餐饮服务实施方案.doc
- 软件测试方案.docx
- 单片机技术课程研究设计报告(篮球计时计分器).doc
- 智慧城市建设PPP模式实践研究.docx
- 大数据技术在特高压变电站运维中的运用.docx
- 软件工程期末复习题(含标准答案).doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈


