小波變換語音消噪(改進(jìn)閾值)_第1頁
小波變換語音消噪(改進(jìn)閾值)_第2頁
小波變換語音消噪(改進(jìn)閾值)_第3頁
小波變換語音消噪(改進(jìn)閾值)_第4頁
小波變換語音消噪(改進(jìn)閾值)_第5頁
已閱讀5頁,還剩23頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、改進(jìn)閾值函數(shù)進(jìn)行語音信號(hào)消噪,但是在程序運(yùn)行過程中頻頻報(bào)錯(cuò)。本人經(jīng)驗(yàn)不足調(diào)試不出,希望求得各位指導(dǎo)。改進(jìn)函數(shù)表達(dá)式附圖clear all; clc; close all;fs=8000; %語音信號(hào)采樣頻率為8000xx=wavread(lw1.wav);x1=xx(:,1);%取單聲道t=(0:length(x1)-1)/8000;y1=fft(x1,2048); %對(duì)信號(hào)做2048點(diǎn)FFT變換f=fs*(0:1023)/2048;figure(1)plot(t,x1) %做原始語音信號(hào)的時(shí)域圖形y=awgn(x1,10,measured); %加10db的高斯白噪聲snr,mse=snrm

2、se(x1,y)%求得信噪比 均方誤差figure(2)plot(t,y) %做加噪語音信號(hào)的時(shí)域圖形c,l=wavedec(y,3,db1);%多尺度一維分解%用db1小波對(duì)信號(hào)進(jìn)行3層分解并提取系數(shù)a3=appcoef(c,l,db1,3);%a2=appcoef(c,l,db1,2);%a1=appcoef(c,l,db1,1);d3=detcoef(c,l,3);d2=detcoef(c,l,2);d1=detcoef(c,l,1);thr1=thselect(d1,rigrsure);%閾值獲取,使用Stein的無偏風(fēng)險(xiǎn)估計(jì)原理thr2=thselect(d2,rigrsure);t

3、hr3=thselect(d3,rigrsure);%利用改進(jìn)閾值函數(shù)進(jìn)行去噪處理gd1=Garrote_gg(d1,thr1);gd2=Garrote_gg(d2,thr2);gd3=Garrote_gg(d3,thr3);c1=a3 gd3 gd2 gd1;y1=waverec(c2,l,db1);%多尺度重構(gòu)snr,mse=snrmse(x1,y1)%求得信噪比 均方誤差figure(3);plot(t,y1);function gd=Garrote_gg(a,b)%a為信號(hào)分解后的小波系數(shù),b為獲得的閾值m=0.2*(a*a)-(b*b);if (abs(a)=b) gd=sign(a

4、)*(abs(a)-b/exp(m);else (abs(a)=b) gd=sign(a)*(abs(a)-b/exp(m);else gd=zeros(size(a);endy1=waverec(c1,l,db1);%多尺度重構(gòu)snr,mse=snrmsel(x1,y1) %求得信噪比 均方誤差figure(3);plot(t,y1);小波去噪軟閾值和硬閾值的matlab仿真程序硬閾值、軟閾值這里有一段不知道有用沒%設(shè)置信噪比和隨機(jī)種子值snr=4;init=2055615866;%產(chǎn)生原始信號(hào)sref和高斯白噪聲污染的信號(hào)ssref,s=wnoise(1,11,snr,init);%用db

5、1小波對(duì)原始信號(hào)進(jìn)行3層分解并提取系數(shù)c,l=wavedec(s,3,db1);a3=appcoef(c,l,db1,3);d3=detcoef(c,l,3);d2=detcoef(c,l,2);d1=detcoef(c,l,1);thr=1;%進(jìn)行硬閾值處理ythard1=wthresh(d1,h,thr);ythard2=wthresh(d2,h,thr);ythard3=wthresh(d3,h,thr);c2=a3 ythard3 ythard2 ythard1;s3=waverec(c2,l,db1);%進(jìn)行軟閾值處理ytsoftd1=wthresh(d1,s,thr);ytsoft

6、d2=wthresh(d2,s,thr);ytsoftd3=wthresh(d3,s,thr);c3=a3 ytsoftd3 ytsoftd2 ytsoftd1;s4=waverec(c3,l,db1);%對(duì)上述信號(hào)進(jìn)行圖示subplot(5,1,1);plot(sref);title(參考信號(hào));subplot(5,1,2);plot(s);title(染噪信號(hào));subplot(5,1,3);plot(s3);title(硬閾值處理);subplot(5,1,4);plot(s4);title(軟閾值處理);matlab小波除噪,為何硬閾值和軟閾值除躁信噪比一樣了?matlab小波除噪,為

7、何硬閾值和軟閾值除躁信噪比一樣了?load leleccum;index=1:1024;f1=leleccum(index); % 產(chǎn)生含噪信號(hào)init=2055615866;randn(seed,init);f2=f1+18*randn(size(x);snr=SNR_singlech(f1,f2) %信噪比subplot(2,2,1);plot(f1);title(含噪信號(hào)); %axis(1,1024,-1,1);subplot(2,2,2);plot(f2);title(含噪信號(hào)); %axis(1,1024,-1,1);%用db5小波對(duì)原始信號(hào)進(jìn)行3層分解并提取系數(shù)c,l=waved

8、ec(f2,3,db6);a3=appcoef(c,l,db6,3);d3=detcoef(c,l,3);d2=detcoef(c,l,2);d1=detcoef(c,l,1);sigma=wnoisest(c,l,1);thr=wbmpen(c,l,sigma,2);%進(jìn)行硬閾值處理ythard1=wthresh(d1,h,thr);ythard2=wthresh(d2,h,thr);ythard3=wthresh(d3,h,thr);c2=a3 ythard3 ythard2 ythard1;f3=waverec(c2,l,db6);%進(jìn)行軟閾值處理ytsoftd1=wthresh(d1,

9、s,thr);ytsoftd2=wthresh(d2,s,thr);ytsoftd3=wthresh(d3,s,thr);c3=a3 ytsoftd3 ytsoftd2 ytsoftd1;f4=waverec(c3,l,db6);%對(duì)上述信號(hào)進(jìn)行圖示subplot(2,2,3);plot(f3);title(硬閾值處理);%axis(1,1024,-1,1);subplot(2,2,4);plot(f4);title(軟閾值處理);%axis(1,1024,-1,1);snr=SNR_singlech(f1,f3)snr=SNR_singlech(f1,f4)信噪比函數(shù)SNR_singlech

10、(I,In)function snr=SNR_singlech(I,In)% 計(jì)算信噪比函數(shù)% I:riginal signal% In:noisy signal(ie. original signal + noise signal)snr=0;Ps=sum(sum(I-mean(mean(I).2);%signal powerPn=sum(sum(I-In).2); %noise powersnr=10*log10(Ps/Pn);小波去噪程序Matlab小波去噪(默認(rèn),強(qiáng)制,給定三種情況)% 利用小波分析對(duì)監(jiān)測采集的信號(hào)進(jìn)行去噪處理,恢復(fù)原始信號(hào)%小波分析進(jìn)行去噪有3中方法:%1、默認(rèn)閾值去

11、噪處理。該方法利用函數(shù)ddencmp( )生成信號(hào)的默認(rèn)閾值,然后利用函數(shù)wdencmp( )進(jìn)行去噪處理;%2、給定閾值去噪處理。在實(shí)際的去噪處理過程中,閾值往往可通過經(jīng)驗(yàn)公式獲得,且這種閾值比默認(rèn)閾值的可信度高。在進(jìn)行閾值量化處理時(shí)可利用函數(shù)wthresh( );%3、強(qiáng)制去噪處理。該方法是將小波分解結(jié)構(gòu)中的高頻系數(shù)全部置0,即濾掉所有高頻部分,然后對(duì)信號(hào)進(jìn)行小波重構(gòu)。這種方法比較簡單,且去噪后的信號(hào)比較平滑,但是容易丟失信號(hào)中的有用成分。% 利用小波分析對(duì)監(jiān)測采集的水輪機(jī)信號(hào)進(jìn)行去噪處理,恢復(fù)原始信號(hào)%Program Start% 載入監(jiān)測所得信號(hào)load default.txt;%裝載

12、采集的信號(hào)x= default;lx=length(x);t=0:1:length(x)-1;% 繪制監(jiān)測所得信號(hào)subplot(2,2,1);plot(t,x);title(原始信號(hào));grid onset(gcf,color,w)set(gca,fontname,times New Roman)set(gca,fontsize,14.0)% 用db1小波對(duì)原始信號(hào)進(jìn)行3層分解并提取小波系數(shù)c,l=wavedec(x,3,db1);%sym8ca3=appcoef(c,l,db1,3);%低頻部分cd3=detcoef(c,l,3);%高頻部分cd2=detcoef(c,l,2);%高頻部分

13、cd1=detcoef(c,l,1);%高頻部分% 對(duì)信號(hào)進(jìn)行強(qiáng)制去噪處理并圖示cdd3=zeros(1,length(cd3);cdd2=zeros(1,length(cd2);cdd1=zeros(1,length(cd1);c1=ca3,cdd3,cdd2,cdd1;x1=waverec(c1,1,db1);subplot(2,2,2);plot(x1);title(強(qiáng)制去噪后信號(hào));grid onset(gcf,color,w)set(gca,fontname,times New Roman)set(gca,fontsize,14.0)% 默認(rèn)閾值對(duì)信號(hào)去噪并圖示%用ddencmp(

14、)函數(shù)獲得信號(hào)的默認(rèn)閾值,使用wdencmp( )函數(shù)實(shí)現(xiàn)去噪過程thr,sorh,keepapp=ddencmp(den,wv,x);x2=wdencmp(gbl,c,l,db1,3,thr,sorh,keepapp);subplot(2,2,3);plot(x2);title(默認(rèn)閾值去噪后信號(hào));grid onset(gcf,color,w)set(gca,fontname,times New Roman)set(gca,fontsize,14.0)% 給定的軟閾值進(jìn)行去噪處理并圖示cd1soft=wthresh(cd1,x,1.465);%經(jīng)驗(yàn)給出軟閾值數(shù)cd2soft=wthresh

15、(cd2,x,1.823); %經(jīng)驗(yàn)給出軟閾值數(shù)cd3soft=wthresh(cd3,x,2.768); %經(jīng)驗(yàn)給出軟閾值數(shù)c2=ca3,cd3soft,cd2soft,cd1soft;x3=waverec(c2,1,db1);subplot(2,2,4);plot(x3);title(給定軟閾值去噪后信號(hào));grid onset(gcf,color,w)set(gca,fontname,times New Roman)set(gca,fontsize,14.0)以上就是三種小波去噪的原程序。但紅色標(biāo)注的地方,我卻運(yùn)行不過去。提示分別問:1,? Error using = horzcatCA

16、T arguments dimensions are not consistent.Error in = tt at 33c1=ca3,cdd3,cdd2,cdd1;2,? Error using = wthresh at 30Invalid argument value.Error in = tt at 54cd1soft=wthresh(cd1,x,1.465);%經(jīng)驗(yàn)給出軟閾值數(shù)請問為什么?關(guān)于小波新閾值去噪改進(jìn)方法里,matlab程序編寫的討論新閾值能有效地克服軟閾值去噪方法中由于估計(jì)值與真實(shí)值之間的恒定偏差而帶來的去噪誤差,也能有效地抑制硬閾值去噪方法中易產(chǎn)生的信號(hào)振蕩現(xiàn)象。但不懂它

17、程序的編寫。 請教高手幫忙解決一下!謝謝了!function y = wthresh(x,sorh,t)%WTHRESH Perform soft or hard thresholding.% Y = WTHRESH(X,SORH,T) returns soft (if SORH = s)% or hard (if SORH = h) T-thresholdingof the input% vector or matrix X. T is the threshold value.% Y = WTHRESH(X,s,T) returns Y = SIGN(X).(|X|-T)+, soft% t

18、hresholding is shrinkage.% Y = WTHRESH(X,h,T) returns Y = X.1_(|X|T), hard% thresholding is cruder.% See also WDEN, WDENCMP, WPDENCMP.% M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 12-Mar-96.% Last Revision: 24-Jul-2007.% Copyright 1995-2007 The MathWorks, Inc.% $Revision: 1.11.4.3 $switch sorhcas

19、e s tmp = (abs(x)-t); tmp = (tmp+abs(tmp)/2; y = sign(x).*tmp;case h y = x.*(abs(x)t);otherwise error(Wavelet:FunctionArgVal:Invalid_ArgVal, . Invalid argument value.)end這是傳統(tǒng)的閾值去噪法,只要你有新的算法,直接改就行了,但是我對(duì)該法有些疑惑,wthresh(x,sorh,thr),若我用趙瑞珍法算出了每個(gè)尺度(假設(shè)J=3)的閾值,那么還用wthresh(x,sorh,thr)去噪時(shí),thr是不是應(yīng)該在之前寫成thr=thr

20、1,thr2,thr3呢?求助高手:Matlab小波去噪中遇見的問題小波程序如下:function y=f1(x);X=xlsread(shoulian.xls); %讀入表格數(shù)據(jù)x=X(:,1); %將表格數(shù)據(jù)的第一列賦值給x軸y=X(:,2); %將表格數(shù)據(jù)的第二列賦值給y軸subplot(2,2,1);plot(x,y,-m*) %畫出圖形hold on;title(原始圖形);grid;%畫出網(wǎng)格%用db4小波對(duì)原始信號(hào)進(jìn)行3層分解并提取系數(shù)還沒有寫好:要增加高頻系數(shù)圖c,l=wavedec(y,3,db4); %對(duì)y進(jìn)行3層分解ca3=appcoef(c,l,db4,3); %提取系

21、數(shù)cd3=detcoef(c,l,3);cd2=detcoef(c,l,2);cd1=detcoef(c,l,1);%對(duì)信號(hào)進(jìn)行強(qiáng)制性去噪處理并圖示結(jié)果cdd3=zeros(1,length(cd3);cdd2=zeros(1,length(cd2);cdd1=zeros(1,length(cd1);c1=ca3 cdd3 cdd2 cdd1;s1=waverec(c1,l,db4);subplot(2,2,2);plot(x,s1,-m*);hold on;title(強(qiáng)制去噪后的信號(hào));grid;%用默認(rèn)閾值對(duì)信號(hào)進(jìn)行去噪處理并圖示結(jié)果%用ddencmp()函數(shù)獲得信號(hào)的默認(rèn)閾值,使用wd

22、encmp()命令函數(shù)實(shí)現(xiàn)去噪過程thr,sorh,keepapp=ddencmp(den,wv,y);s2=wdencmp(gbl,c,l,db4,3,thr,sorh,keepapp);subplot(2,2,3);plot(x,s2,-m*);hold on;title(默認(rèn)閾值去噪后的信號(hào));grid;%用給定的軟閾值進(jìn)行去噪處理cdd1soft=wthresh(cd1,s,1.465);cdd2soft=wthresh(cd2,s,1.823);cdd3soft=wthresh(cd3,s,2.768);c2=ca3 cdd3soft cdd2soft cdd1soft;s3=wav

23、erec(c2,l,db4);subplot(2,2,4);plot(x,s3,-m*);title(給定軟閾值去噪后的信號(hào));gridclear;錯(cuò)誤顯示:? Error using = horzcatAll matrices on a row in the bracketed expression must have thesame number of rows.Error in = xnn at 41c2=ca3 cdd3soft cdd2soft cdd1soft;i以至于最后一個(gè)圖形沒法顯示同時(shí)處理后的圖形數(shù)據(jù)怎么調(diào)出來,以及第一個(gè)數(shù)據(jù)應(yīng)該是【0,0】,但是處理后的不是。請問是我選擇

24、的分解重構(gòu)函數(shù)部隊(duì)還是其他原因請問如何修改需要說明的是:收斂表格的兩組數(shù)據(jù)為:00.0020.4940.9451.0361.0371.48101.49111.86141.96191.78262.75282.78312.71342.54392.85472.71492.71545.43615.47685.47755.20請教程序問題,心電信號(hào)去噪的matlab程序想把這個(gè)程序。改為只用軟硬閾值對(duì)比的心電信號(hào)去噪分析,該怎么辦? 求高手。程序見下:%信號(hào)小波分解%基于Haar小波%ecg=fopen(100.dat,r);N=1201;data=fread(ecg,N,int16);data=dat

25、a/10000;save ECGdata data;fclose(ecg);x=0:0.004:4.8;figure(1);subplot(321);plot(x,data);axis(0 4.8 -4 4);title(原始心電信號(hào));x=data;wname=Haar;level=5;c,l=wavedec(x,level,wname);a5=wrcoef(a,c,l,Haar,5);a4=wrcoef(a,c,l,Haar,4);a3=wrcoef(a,c,l,Haar,3);a2=wrcoef(a,c,l,Haar,2);a1=wrcoef(a,c,l,Haar,1);subplot(

26、322);plot(a5);title(a5);axis(0 1201 -2 2);subplot(323);plot(a4);title(a4);axis(0 1201 -2 2);subplot(324);plot(a3);title(a3);axis(0 1201 -2 2);subplot(325);plot(a2);title(a2);axis(0 1201 -2 2);subplot(326);plot(a1);title(a1);axis(0 1201 -2 2);%基于db6小波%ecg=fopen(100.dat,r);N=1201;data=fread(ecg,N,int1

27、6);data=data/10;fclose(ecg);x=0:0.004:4.8;figure(2);subplot(321);plot(x,data);axis(0 4.8 -4000 4000);title(原始心電信號(hào));x=data;wname=db6;level=5;c,l=wavedec(x,level,wname);a5=wrcoef(a,c,l,db6,5);a4=wrcoef(a,c,l,db6,4);a3=wrcoef(a,c,l,db6,3);a2=wrcoef(a,c,l,db6,2);a1=wrcoef(a,c,l,db6,1);subplot(322);plot(

28、a5);title(a5);axis(0 1201 -2000 2000);subplot(323);plot(a4);title(a4);axis(0 1201 -2000 2000);subplot(324);plot(a3);title(a3);axis(0 1201 -2000 2000);subplot(325);plot(a2);title(a2);axis(0 1201 -2000 2000);subplot(326);plot(a1);title(a1);axis(0 1201 -2000 2000);%基于sym3小波%ecg=fopen(100.dat,r);N=1201;

29、data=fread(ecg,N,int16);data=data/10;save ECGdata data;fclose(ecg);x=0:0.004:4.8;figure(3);subplot(321);plot(x,data);axis(0 4.8 -4000 4000);title(原始心電信號(hào));x=data;wname=sym3;level=5;c,l=wavedec(x,level,wname);a5=wrcoef(a,c,l,sym3,5);a4=wrcoef(a,c,l,sym3,4);a3=wrcoef(a,c,l,sym3,3);a2=wrcoef(a,c,l,sym3,

30、2);a1=wrcoef(a,c,l,sym3,1);subplot(322);plot(a5);title(a5);axis(0 1201 -2000 2000);subplot(323);plot(a4);title(a4);axis(0 1201 -2000 2000);subplot(324);plot(a3);title(a3);axis(0 1201 -2000 2000);subplot(325);plot(a2);title(a2);axis(0 1201 -2000 2000);subplot(326);plot(a1);title(a1);axis(0 1201 -2000

31、 2000);%心電信號(hào)降噪%Birge-Massart策略閾值降噪%基于小波變換的心電信號(hào)的降噪ecg=fopen(100.dat,r);N=1201;data=fread(ecg,N,int16);data=data/10000;fclose(ecg);x=data;wavename=db5;level=4;c,l=wavedec(x,level,wavename);alpha=1.5;sorh=h;thr,nkeep=wdcbm(c,l,alpha);%使用硬閾值給信號(hào)降噪xc,cxc,lxc,perf0,perfl2=wdencmp(lvd,c,l,wavename,level,thr

32、,sorh);t1=0:0.004:(length(x)-1)*0.004;figure(4);subplot(211);plot(t1,x);title(從人體采集的原始的ECG信號(hào));subplot(212);plot(t1,xc);title(Birge-Massart策略閾值降噪后的ECG信號(hào)(wname=db5 level=4));%最優(yōu)預(yù)測軟閾值降噪%基于小波變換的心電信號(hào)的壓縮ecg=fopen(100.dat,r);N=1201;data=fread(ecg,N,int16);data=data/10000;fclose(ecg);x=data;wavename=db3;lev

33、el=4;xd,cxd,lxd=wden(x,heursure,s,mln,level,wavename);t=0:0.004:4.8;figure(5);subplot(311);plot(t,x);title(從人體采集的原始的ECG信號(hào));subplot(312);plot(t,xd);title(heursure規(guī)則閾值降噪后的ECG信號(hào)(db3 level=4);%最小均方差軟閾值降噪%基于小波變換的心電信號(hào)的壓縮ecg=fopen(100.dat,r);N=1201;data=fread(ecg,N,int16);data=data/10000;fclose(ecg);x=data

34、;wavename=db3;level=4;xd=wden(x,minimaxi,s,mln,level,wavename);t=0:0.004:4.8;figure(6);subplot(311);plot(t,x);title(從人體采集的原始的ECG信號(hào));subplot(313);plot(t,xd);title(Minimax規(guī)則閾值降噪后的ECG信號(hào)(wname=db3 level=4);%心電信號(hào)壓縮%基于小波變換的心電信號(hào)的壓縮ecg=fopen(100.dat,r);N=1201;data=fread(ecg,N,int16);data=data/10000;fclose(e

35、cg);x=data;wavename=db5;c,l=wavedec(x,4,wavename);alpha=2;sorh=h;thr,nkeep=wdcbm(c,l,alpha);%使用硬閾值壓縮信號(hào)xc,cxc,lxc,perf0,perfl2=wdencmp(lvd,c,l,wavename,4,thr,sorh);t=0:0.004:4.8;figure(7);subplot(511);plot(t,x);title(原始的ECG信號(hào));axis(0 5 -3 3);subplot(512);plot(t,xc);axis(0 5 -3 3);title(在第4層對(duì)高頻系數(shù)量化壓縮后

36、的ECG信號(hào)(alpha=2 db5));c,l=wavedec(x,4,wavename);alpha=4;sorh=h;thr,nkeep=wdcbm(c,l,alpha);%使用硬閾值壓縮信號(hào)xc1,cxc1,lxc1,perf01,perfl21=wdencmp(lvd,c,l,wavename,4,thr,sorh);subplot(513);plot(t,xc1);axis(0 5 -3 3);title(在第4層對(duì)高頻系數(shù)量化壓縮后的ECG信號(hào)alpha=4 db5);c,l=wavedec(x,2,wavename);alpha=4;sorh=h;thr,nkeep=wdcbm

37、(c,l,alpha);%使用硬閾值壓縮信號(hào)xc1,cxc1,lxc1,perf01,perfl21=wdencmp(lvd,c,l,wavename,2,thr,sorh);subplot(514);plot(t,xc1);axis(0 5 -3 3);title(在第2層對(duì)高頻系數(shù)量化壓縮后的ECG信號(hào)alpha=4 db5);c,l=wavedec(x,2,db3);alpha=4;sorh=h;thr,nkeep=wdcbm(c,l,alpha);%使用硬閾值壓縮信號(hào)xc1,cxc1,lxc1,perf01,perfl21=wdencmp(lvd,c,l,db3,2,thr,sorh)

38、;subplot(515);plot(t,xc1);axis(0 5 -3 3);title(在第2層對(duì)高頻系數(shù)量化壓縮后的ECG信號(hào)alpha=4 db3);%求助解決信號(hào)降噪問題求高手幫忙,我的一個(gè)實(shí)驗(yàn)數(shù)據(jù)要進(jìn)行信號(hào)降噪,需要用到Birge-Massar閾值降噪,penalty閾值降噪和缺省的閾值降噪這3種降噪方法,并通過比較得出最好的處理方法。如果有那位好心高手幫忙,小弟感激不盡?。≌垘兔Φ母呤謳拖旅Π?!按LZ的要求程序和得圖如下xx=load(實(shí)驗(yàn)數(shù)據(jù).txt);x=xx(:,1);y=xx(:,2);x=x(end:-1:1);y=y(end:-1:1);% 用sym6小波對(duì)信號(hào)做5

39、層分解wname =sym6; lev=5;c,l = wavedec(y,lev,wname);% 通過第1層的細(xì)節(jié)系數(shù)估算信號(hào)的噪聲強(qiáng)度sigma = wnoisest(c,l,1);% 使用penalty策略確定降噪的閾值alpha=2;thr1 = wbmpen(c,l,sigma,alpha);% 使用Birge-Massart策略確定降噪的閾值thr2,nkeep = wdcbm(c,l,alpha);xd1 = wdencmp(gbl,c,l,wname,lev,thr1,s,1);% 用缺省的閾值確定的時(shí)候使用硬閾值時(shí)系數(shù)進(jìn)行處理xd2,cxd,lxd,perf0,perf2=

40、 wdencmp(lvd,c,l,wname,lev,thr2,h);% 求得缺省的閾值thr,sorh,keepapp = ddencmp(den,wv,x);% 重建降噪信號(hào)xd3 = wdencmp(gbl,c,l,wname,lev,thr,s,1);figuresubplot(411); plot(y); title(原始信號(hào),fontsize,10);subplot(412); plot(xd1); title(使用penalty閾值降噪后信號(hào),fontsize,10);subplot(413); plot(xd2); title(使用Birge-Massart閾值降噪后信號(hào),fo

41、ntsize,10);subplot(414); plot(xd2); title(使用缺省閾值降噪后信號(hào), fontsize,10);eb1a.jpg(41.07 KB, 下載次數(shù): 4)小波去噪:為什么閾值去噪后總把有用信息也給濾出了wavename=English.wav;%聲源layer=3;%分解尺度wavelets=db3;%小波選擇SNR_noise=10;%添加噪音的信噪比TPTR=rigrsure;%閾值選取原則sorh=s;%軟閾值 或 硬閾值scal=mln;%閾值每層調(diào)整%導(dǎo)入聲源 并 添加白噪聲s=wavread(wavename);y=awgn(s(1,:),SNR

42、_noise,measured);%聲源為雙聲道 只提取一個(gè)聲道分析subplot(211),plot(s(1,:);title(Original Sound Wave);subplot(212),plot(y);title(Sound Wave with White-Noise);%對(duì)含噪聲源進(jìn)行離散小波分解,并提取高低頻系數(shù)C,L=wavedec(y,layer,wavelets);A=appcoef(C,L,wavelets,layer);D=detcoef(C,L,wavelets,layer);%各層閾值選擇for n=1:layer thre(n)=thselect(Dn,TPTR

43、);end%對(duì)各系數(shù)進(jìn)行閾值去噪for n=1:layer D_recn=wthresh(Dn,sorh,thre(n);endfigure;k=0;for n=1:layer subplot(layer,2,k+1),plot(Dn); title(Detail.cfs level before threshing,num2str(n) subplot(layer,2,k+2),plot(D_recn); title(Detail.cfs level after threshing,num2str(n) k=k+2;end%重構(gòu)信號(hào)C1=A;for n=1:layer C1=C1,Dn;en

44、dy_rec=waverec(C1,L,wavelets);figure;subplot(311),plot(s(1,:);title(Original Sound Wave);subplot(312),plot(y);title(Sound Wave with White-Noise);subplot(313),plot(y_rec);title(De-Noised Sound Wave);為什么用thselect函數(shù)選取的閾值進(jìn)行濾噪后 高頻系數(shù)全為零了 我只是想把高頻中的噪聲信號(hào)濾出,高手執(zhí)教本帖最后由 cwjy 于 2010-5-2 07:52 編輯1.jpg(117.12 KB, 下

45、載次數(shù): 0)(TDC)的語音增強(qiáng)程序,適用于噪聲為白噪聲的情況%基于Ephraim和Van Trees提出的信號(hào)子空間法(TDC)的語音增強(qiáng)程序,適用于噪聲為白噪聲的情況% 08.3.22 magic SCUclear;%-參數(shù)定義-frame_len=40; %幀長step_len=0.5*frame_len; %分幀時(shí)的步長,相當(dāng)于重疊50%N=8; %計(jì)算Toeplitz協(xié)方差矩陣時(shí)用到的前后相鄰的幀數(shù),N為偶數(shù)%-讀入帶噪語音文件-filename,pathname=uigetfile(*.wav,請選擇語音文件:);wavin,fs,nbits=wavread(pathname filename);wav_length

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論