内容发布更新时间 : 2024/11/14 11:33:24星期一 下面是文章的全部内容请认真阅读。
附 录
title('滤波前信号的频谱','fontweight','bold'); axis([0 15000 0 1000]); grid;
subplot(2,2,2); plot(abs(m21),'r');
title('滤波后信号的频谱','fontweight','bold'); axis([0 15000 0 1000]); grid; subplot(2,2,3); plot(s);
title('滤波前信号的波形','fontweight','bold'); axis([67000 87000 -0.5 0.5]); grid; subplot(2,2,4); plot(z21);
title('滤波后信号的波形','fontweight','bold'); axis([67000 87000 -0.5 0.5]); grid;
% --- Executes on button press in pushbutton15.
function pushbutton15_Callback(hObject, eventdata, handles)
[y,fs,nbits]= wavread('E:\\yuanyinpin.wav'); n = length (y) Noise=0.03*randn(n,2); s=y+Noise; S=fft(s); Ft=10000; Fp=700; Fs=1400; wp=2*Fp/Ft; ws=2*Fs/Ft; rp=1; rs=50;
p=1-10.^(-rp/20); q=10.^(-rs/20); fpts=[wp ws]; mag=[1 0]; dev=[p q];
21
¨ 附 录
[n21,wn21,beta,ftype]=kaiserord(fpts,mag,dev); b21=fir1(n21,wn21,kaiser(n21+1,beta)); z21=fftfilt(b21,s); sound(z21,fs);
m21=fft(z21); figure(4); subplot(2,2,1); plot(abs(S),'g');
title('滤波前信号的频谱','fontweight','bold'); axis([0 15000 0 1000]); grid; subplot(2,2,2); plot(abs(m21),'r');
title('滤波后信号的频谱','fontweight','bold'); axis([0 15000 0 1000]); grid; subplot(2,2,3); plot(s);
title('滤波前信号的波形','fontweight','bold'); axis([67000 87000 -0.5 0.5]); grid; subplot(2,2,4); plot(z21);
title('滤波后信号的波形','fontweight','bold'); axis([67000 87000 -0.5 0.5]); grid;
% --- Executes on button press in pushbutton17.
function pushbutton17_Callback(hObject, eventdata, handles) [y,fs,nbits]= wavread('E:\\yuanyinpin.wav'); n = length (y) Noise=0.03*randn(n,2); s=y+Noise; S=fft(s); Ft=10000; Fp=1400;
22
附 录
Fs=700; wp=2*Fp/Ft; ws=2*Fs/Ft; rp=1; rs=50;
p=1-10.^(-rp/20); q=10.^(-rs/20); fpts=[ws wp]; mag=[0 1]; dev=[p q];
[n23,wn23,beta,ftype]=kaiserord(fpts,mag,dev);
b23=fir1(n23,wn23,'high',kaiser(n23+1,beta)); z23=fftfilt(b23,s); sound(z23,fs);
m23=fft(z23); figure; subplot(2,2,1); plot(abs(S),'g');
title('滤波前信号的频谱','fontweight','bold'); axis([0 15000 0 1000]); grid; subplot(2,2,2); plot(abs(m23),'r');
title('滤波后信号的频谱','fontweight','bold'); axis([0 15000 0 1000]); grid; subplot(2,2,3); plot(s);
title('滤波前信号的波形','fontweight','bold'); axis([67000 87000 -0.5 0.5]); grid; subplot(2,2,4); plot(z23);
title('滤波后信号的波形','fontweight','bold'); axis([67000 87000 -0.5 0.5]); grid;
23
附 录
% --- Executes on button press in pushbutton19.
function pushbutton19_Callback(hObject, eventdata, handles) [y,fs,nbits]= wavread('E:\\yuanyinpin.wav'); n = length (y) Noise=0.03*randn(n,2); s=y+Noise; S=fft(s); Fp1=1200; Fp2=3000; Fs1=1000; Fs2=3200; Ft=2200;
wp1=tan(pi*Fp1/Ft); wp2=tan(pi*Fp2/Ft); ws1=tan(pi*Fs1/Ft); ws2=tan(pi*Fs2/Ft); w=wp1*wp2/ws2; bw=wp2-wp1; wp=1;
ws=(wp*wp2-w.^2)/(bw*w);
[n22,wn22]=buttord(wp,ws,1,50,'s'); [b22,a22]=butter(n22,wn22,'s'); z22=fftfilt(b22,s); sound(z22,fs);
m22=fft(z22); figure; subplot(2,2,1); plot(abs(S),'g');
title('滤波前信号的频谱','fontweight','bold'); axis([0 15000 0 1000]); grid; subplot(2,2,2); plot(abs(m22),'r');
title('滤波后信号的频谱','fontweight','bold'); axis([0 15000 0 1000]); grid;
subplot(2,2,3); plot(s);
24
附 录
title('滤波前信号的波形','fontweight','bold'); axis([67000 87000 -0.5 0.5]); grid; subplot(2,2,4); plot(z22);
title('滤波后信号的波形','fontweight','bold'); axis([67000 87000 -0.5 0.5]); grid;
% --- Executes on button press in pushbutton20.
function pushbutton20_Callback(hObject, eventdata, handles) % hObject handle to pushbutton20 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton8.
function pushbutton8_Callback(hObject, eventdata, handles) [y,fs,nbits]=wavread('E:\\yuanyinpin.wav'); sound(y,fs,nbits); n=length(y);
Y=fft(y,n);
function pushbutton9_Callback(hObject, eventdata, handles) [y,fs,nbits]=wavread('E:\\yuanyinpin.wav'); n=length(y); Y=fft(y,n); figure; subplot(2,1,1); plot(y);
title('原始信号波形','fontweight','bold'); axis([67000 87000 -0.5 0.5]); grid; subplot(2,1,2); plot(abs(Y));
25