预览加载中,请您耐心等待几秒...
1/10
2/10
3/10
4/10
5/10
6/10
7/10
8/10
9/10
10/10

亲,该文档总共38页,到这已经超出免费预览范围,如果喜欢就直接下载吧~

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

MATLAB处理语音信号滤波程序 巴特沃思滤波器滤波 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%参数初始化%%%%%%%%%%%%%%%% clearall;%关闭以往仿真的数据栈 A=5;%噪声的振幅 u1=0.01;%噪声振幅的衰减系数 u2=0.02; u3=0.03; f1=50;%多频噪声频率 f2=200; f3=800; [Y,fs,bits]=wavread('0601331007.wav')%读出信号1,采样率和采样位数 %sound(Y,fs); %[X,Fs,bits]=wavread('0601331007.wav');%读出信号2,采样率和采样位数 n=length(Y);%求采样信号1的长度 %m=length(X);%求采样信号2的长度 t=0:1/fs:(n-1)/fs;%求采样信号1时域上的采样点数 %t1=0:1/Fs:(m-1)/fs;%求采样信号2时域上的采样点数 %%%%%%t=(0:n-1)/fs; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%构造噪声%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% y1=u1*A*sin(2*pi*f1*t)+u1*A*sin(2*pi*f2*t)%两两噪声相加 y2=u1*A*sin(2*pi*f3*t) y=y1+y2 %%%%%%Z1=u1*A*sin(2*pi*f1*t1)+u1*A*sin(2*pi*f2*t1)%两两噪声相加 %%%%%%Z2=u1*A*sin(2*pi*f3*t1) %%%%%%Z=Z1+Z2 %figure(1)%画出噪声的时域图,取200个点 %%%%%%%%%%plot(t,y);gridon; %plot(t(1:200),y(1:200));gridon; % %xlabel('时间(t)'); %ylabel('幅度(y)'); %title('噪声的时域图'); % %Fy=fft(y,n);%对噪声进行傅立叶变换 %Fy1=abs(Fy); %n1=floor(n/2);%对zhang求采样点数的一半 %n2=floor(m/2);%对zhanglow求采样点数的一半 %f=(0:n1)*fs/n;%时域上的采样点数 %f1=(0:n2)*Fs/m;%时域上的采样点数 % %figure(2)%画出噪声的频谱图 %plot(f,Fy1(1:n1+1));gridon; %xlabel('频率(f)'); %ylabel('幅度(Fy1)'); %title('噪声的频谱图'); % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%加噪声前后的时域图比较%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Y=Y(:,1);%此处假设声音是双声道的,只取单声道作分析 %X=X(:,1);%此处假设声音是双声道的,只取单声道作分析 Y1=y+Y';%对采样信号进行转置再加上噪声 %pause(10);%暂停10s sound(Y1,fs);%读出加噪声后的采样信号 %figure(3)%画出加噪声前后的时域比较图 %subplot(2,1,1);plot(t,Y);gridon; %plot(t(1:1000),Y(1:1000));gridon; %xlabel('时间(t)'); %ylabel('幅度(Y)'); %title('加噪声前的时域图'); % %subplot(2,1,2);plot(t,Y1);gridon; %%%%%%%%%%plot(t(1:1000),Y1(1:1000));gridon; %xlabel('时间(t)'); %ylabel('幅度(Y1)'); %title('加噪声后的时域图'); % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%加噪声前后的频域图比较%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % %FY=fft(Y1,n);%对加噪声后的采样信号1进行傅立叶变换 %FY1=abs(FY); %FY2=fft(Y,n);%对加噪声前的采样信号1进行傅立叶变换 %FY3=abs(FY2); %FX=fft(X,m);%对加噪声前的采样信号2进行傅立叶变换 %FX4=abs(FX); % %figure(4)%画出加噪声前后的频域比较图 %subplot(2,1,1); %plot