1、 信号课程设计报告书 ---语音信号处理 学院:信息工程学院 专业班级:通信工程 081 姓名:XX 学号:XXXXXX 1、信号的抽样和恢复 正弦波2KHz抽样输出 正弦波2KHz抽样恢复 正弦波8KHz抽样输出 正弦波8KHz抽样恢复 正弦波16KHz抽样输出
2、 正弦波16KHz抽样恢复 三角波2KHz抽样输出 三角波2KHz抽样恢复 三角波8KHz抽样输出 三角波8KHz抽样恢复 三角波16KHz抽样输出 三角波16KHz抽样恢复 巴特沃斯低通滤波器图形 低通李沙育图形 巴特沃斯高通滤波器图形
3、 高通李沙育图形 巴特沃斯带通滤波器图形 带通李沙育图形 2、对连续信号进行抽样恢复 t=0:0.001:6; x=cos(5*pi*t); subplot(3,1,1); plot(t,x); axis([0,1,-1.1,1.1]); title('原有x'); xlabel('t');ylabel('x(t)') fs=2; %采样频率 ts=1/fs
4、 tp=1; n=0:tp/ts; xn=cos(n*ts*0.5*pi); subplot(3,1,2) stem(n*ts,xn); title('fs=2HZ取样后的x');xlabel('t');ylabel('x(nT)') dt=ts/50; %每个采样间隔上取点数 t1=0:dt:6; %生成序列t1 tp=1; %重构时间区间为1s n=0:tp/ts; tmn=ones(length(n),1)*t1-n'*ts*ones(1,length(t1)); xr1=sinc(fs*tmn);
5、x2=xn*xr1; subplot(3,1,3) plot(t1,x2); axis([0,1,-1.1,1.1]); x0=cos(0.5*pi*t1); emax=max(abs(x0-x2)) emax = 1.9492 title('用抽样内插函数恢复的结果'); 3、语音信号抽样恢复比较 [x,fs]=wavread('xiang1.wav'); subplot(2,2,1) plot(x); title('语音信号原有16k采样波形'); x1=fft(x); subplot(2,2,2);plot(abs
6、x1)); title('语音信号原有16k采样波形频谱'); n=1:length(x); n2=1:0.25:length(x); yi=interp1(n,x,n2); sound('yi') subplot(2,2,3) plot(n2,yi); title('内差恢复波形'); y2=fft(yi); subplot(2,2,4);plot(abs(y2)); title('语音信号内差恢复波形频谱'); figure(2) y2=decimate(yi,2); subplot(2,2,1) plot(y2); title('8k采样波形')
7、 y21=fft(y2); subplot(2,2,2);plot(abs(y21)); title('8k采样波形频谱'); sound('y21') y3=decimate(yi,4); sound('y3'); subplot(2,2,3) plot(y3); title('4k采样波形'); y31=fft(y3); subplot(2,2,4);plot(abs(y31)); title('4k采样波形频谱'); sound('y31') 4、模拟及数字滤波器设计 N=4;fc=22000;fs=160000;T=1/fs;w
8、c=2*pi*fc; [B,A]=butter(N,wc,'s'); [mag0,w0]=freqs(B,A); subplot(2,1,1);plot(w0/1000/2/pi,abs(mag0)); title('模拟巴特沃思低通滤波器幅频特性’); xlabel('频率/KHz');ylabel('幅度'); [B,A]=butter(N,wc*T,'s') [b,a]=imp_invr(B,A,1) [db,mag,pha,grd,w]=freqz_m(b,a); subplot(2,1,2); plot(w/pi,mag); title('数字巴特沃思低通滤波
9、器幅频特性'); xlabel('w/pi');ylabel('幅度'); axis([0,1,0,1]); 、 N=4;fc=26000;fs=200000;T=1/fs;wc=2*pi*fc; [B,A]=butter(N,wc,'high','s'); [mag0,w0]=freqs(B,A); subplot(2,1,1);plot(w0/1000/pi/2,abs(mag0)); title('模拟巴特沃思高通滤波器幅频特性'); xlabel('频率/KHz');ylabel('幅度'); [b,a]=bilinear(B,A,f
10、s); [mag1,w1]=freqz(b,a); subplot(2,1,2);plot(w1/pi,abs(mag1)); title('数字巴特沃思高通滤波器幅频特性'); xlabel('w/pi');axis([0,0.8,0,1]); N=4;fs=160000;T=1/fs; fc1=23000;fc2=28000; wcl=fc1*2*pi;wc2=2*pi*fc2; wc=[wcl,wc2]; [B,A]=butter(N,wc,'bandpass','s'); [mag0,w0]=freqs(B,A); subplot(2,1,1)
11、plot(w0/pi/2,abs(mag0)); title('模拟巴特沃思带通滤波器幅频特性'); xlabel('频率/Hz');ylabel('幅度');axis([10000,40000,0,1]); [b,a]=bilinear(B,A,fs); [mag1,w1]=freqz(b,a); subplot(2,1,2);plot(w1/pi,abs(mag1)); title('数字巴特沃思带通滤波器幅频特性'); xlabel('w/pi');ylabel('幅度');axis([0.1,0.5,0,1]); 5、语音加噪声及滤波后比较 [x
12、fs]=wavread('ai30');N=length(x); n=0:length(x)-1;c=2*pi*n/N; y=fft(x,length(x)); subplot(2,2,1);plot(x);title('语音信号时域波形'); subplot(2,2,2);plot(c,abs(y));title('语音信号幅频特性'); x1=0.008*cos(0.75*2*pi*n);y1=x'+x1;y2=fft(y1); subplot(2,2,3);plot(y1);title('加噪音后的波形'); subplot(2,2,4);plot(abs(y2));t
13、itle('加噪音后的频谱'); figure(2) [n,m]=butter(4,0.5,'low');[db,mag,pha,w]=freqz_m(n,m); subplot(2,2,1);plot(w,mag);title('滤波器的幅度特性'); subplot(2,2,2);plot(w,pha);title('滤波器的相频特性'); T=200000;wc1=1;N=4; [B,A]=butter(N,wc1,'s');[Bz,Az]=impinvar(B,A); z=filter(Bz,Az,y1); z1=fft(z); subplot(2,2,3);plot
14、z);title('加噪音滤波后的波形'); subplot(2,2,4);plot(abs(z1));title('加噪音滤波后的频谱'); 6、三个频率信号叠加及滤波实现 t=0:1000;x=cos(0.3*pi*t)+2*sin(0.6*pi*t)+cos(0.8*pi*t);X=fft(x); figure(1) subplot(2,2,1);plot(t,x);title('连续信号时域波形');axis([0,60,-4,4]); subplot(2,2,2);plot(abs(X));title('连续信号频谱图');
15、 figure(2) wp1=0.35;ws1=0.4;As=20;Rp=1; [N1,wc1]=buttord(wp1,ws1,Rp,As);[b1,a1]=butter(N1,wc1); [mag1,w1]=freqz(b1,a1); subplot(3,1,1);plot(w1/pi,abs(mag1));title('数字巴特沃思低通滤波器幅度特性'); wp2=[0.5,0.65];ws2=[0.45,0.75]; [N2,wc2]=buttord(wp2,ws2,Rp,As);[b2,a2]=butter(N2,wc2,'bandpa
16、ss'); [mag2,w2]=freqz(b2,a2); subplot(3,1,2);plot(w2/pi,abs(mag2));title('数字巴特沃思带通滤波器幅度特性'); wp3=0.7;ws3=0.65; [N3,wc3]=buttord(wp3,ws3,Rp,As);[b3,a3]=butter(N3,wc3,'high'); [mag3,w3]=freqz(b3,a3); subplot(3,1,3);plot(w3/pi,abs(mag3));title('数字巴特沃思高通滤波器幅度特性'); figure(3) y1=filter(b1,
17、a1,x);Y1=fft(y1); subplot(3,2,1);plot(t,y1);title('低通滤波器滤波后时域波形');axis([0,60,-1,1]); subplot(3,2,2);plot(abs(Y1));title('低通滤波器滤波后频谱图'); y2=filter(b2,a2,x);Y2=fft(y2); subplot(3,2,3);plot(t,y2);title('带通滤波器滤波后时域波形');axis([0,60,-2,2]); subplot(3,2,4);plot(abs(Y2));title('带通滤波器滤波后频谱图'); y3=filter
18、b3,a3,x);Y3=fft(y3); subplot(3,2,5);plot(t,y3);axis([0,30,-1,1]);title('高通滤波器滤波后时域波形'); subplot(3,2,6);plot(abs(Y3));title('高通滤波器滤波后频谱图'); figure(4) z=cos(0.1*pi*t);y=x+z;Y=fft(y); subplot(2,1,1);plot(t,y);title('加噪声后时域波形');axis([0,60,-5,5]); subplot(2,1,2);plot(abs(Y));title('加噪声后频谱图');
19、 figure(5) wpl=0.25;wph=0.85;wsl=0.2;wsh=0.9; ws4=[wsl,wsh];wp4=[wpl,wph]; [N4,wc4]=buttord(wp4,ws4,Rp,As);[b4,a4]=butter(N4,wc4,'bandpass'); [mag4,w4]=freqz(b4,a4); y1=filter(b4,a4,y);Y1=fft(y1); plot(w4/pi,abs(mag4));title('带通滤波器幅度特性');axis([0,1,0,1.1]); figure(6) subplot(2,2
20、1);plot(t,y1);axis([0,100,-4,4]);title('去噪声后时域波形'); subplot(2,2,2);plot(abs(Y1));title('去噪声后频谱图'); M=length(y1);m=0:M-1;mi=0:0.1:(M-1)/10; ym=interp1(m,y1,mi);Ym=fft(ym); subplot(2,2,3);plot(m,y1,,mi,ym); title('恢复出的连续信号时域波形');axis([0,100,-4,4]); subplot(2,2,4);plot(abs(Ym));title('恢复后的连续信号频谱图'); 7、simulink 动态仿真






