MATLAB语音信号加噪去噪

2025-04-13 22:04:21
推荐回答(1个)
回答1:

fs = 44100; %采样率
f0 = 5000;   %信号频率
N = 1024;

%巴特沃斯低通滤波器

Wp = 10000/fs; 
Ws = 15000/fs;
Rp = 3;
Rs = 60;
[n,Wn] = buttord(Wp,Ws,Rp,Rs);

[b,a] = butter(n,Wn);
figure;
freqz(b,a,N); 
title('巴特沃斯低通滤波器特性');


tp = N/fs; %采样时长
t = 0:1/fs:tp;
y = sin(2*pi*f0*t);  %信号
yn = y + rand(1,N+1); %加噪声

%显示10个周期
t2 = 0:1/fs:10/f0;
L = length(t2);

figure;
subplot(311);plot(t2,y(1:L));title('信号');ylim([-2,2]);
subplot(312);plot(t2,yn(1:L));title('信号加噪声');ylim([-2,2]);

%滤波
yf = filter(b,a,yn);
subplot(313);plot(t2,yf(1:L));title('滤波后信号');ylim([-2,2]);