资源描述:
《小波去噪举例》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、[4]§4.6小波去噪举例4.6.1MATLAB中用wnoise函数测试去噪算法sqrt_snr=3;init=231434;[x,xn]=wnoise(3,11,sqrt_snr,init);%WNOISEgeneratenoisywavelettestdata.%X=WNOISE(FUN,N)returnsvaluesofthetestfunctiongivenbyFUN,ona%2^Nsampleof[0,1].[X,XN]=WNOISE(FUN,N,SQRT_SNR)returnsthe%previousvectorXrescaledsuchtha
2、tstd(x)=SQRT_SNR.Thereturned%vectorXNcontainsthesametestvectorXcorruptedbyanadditiveGaussian%whitenoiseN(0,1).ThenXNhasasignal-to-noiseratioof(SQRT_SNR^2).%[X,XN]=WNOISE(FUN,N,SQRT_SNR,INIT)returnspreviousvectorsXand%XN,butthegeneratorseedissettoINIvalue.subplot(3,2,1),plot(x)titl
3、e('originaltestfunction')subplot(3,2,2),plot(xn)title('noisedfunction')%产生一个长为2**11点,包含高斯白噪声的正弦信号,噪声的的标准偏差为3。lev=5;xd=wden(x,'heursure','s','one',lev,'sym8');%[XD,CXD,LXD]=WDEN(X,TPTR,SORH,SCAL,N,'wname')%returnsade-noisedversionXDofinputsignalXobtainedbythresholdingthe%waveletcoe
4、fficients.Additionaloutputarguments[CXD,LXD]arethewavelet%decompositionstructureofde-noisedsignalXD.(WDEN根据信号小波分解%结构[C,L]对信号进行去噪处理,返回处理信号XD,以及XD的小波分解%结构{CXD,LXD})。%TPTR(containsthresholdselectionrule)='heursure',%'heursure'isanheuristicvariantofthefirstoption%(选择基于Stein无偏估计理论的自适应域
5、值的启发式改进)%SORH('s'or'h')isforsoftorhardthresholding(决定域值的使用方式)%SCAL(='onedefinesmultiplicativethresholdrescaling:'one'fornorescaling%(决定域值是否随噪声变化)'wname'='sym8'subplot(3,2,3),plot(xd)title('Onede-noisedfunction')%利用’sym8’小波对信号分解,在分解的第5层上,利用启发式SURE域值选择法对信号去噪。xd=wden(x,'heursure','s'
6、,'sln',lev,'sym8');%'sln'forrescalingusingasingleestimation%oflevelnoisebasedonfirstlevelcoefficients(根据第一层小波分解的噪声方%差调整域值)subplot(3,2,4),plot(xd)title('Slnde-noisedfunction')%同上’sym8’小波对信号分解条件,但用软SURE域值选择算法对信号去噪。xd=wden(x,'sqtwolog','s','sln',lev,'sym8');%foruniversalthresholdsqrt
7、(2*log(.))(固定域值选择算法去噪).subplot(3,2,5),plot(xd)title('Sqtwologde-noisedfunction')%同上’sym8’小波对信号分解条件,但用固定域值选择算法去噪。[c,l]=wavedec(x,lev,'sym8');%WAVEDECperformsamultilevel1-Dwaveletanalysisusingeitheraspecific%wavelet'wname'oraspecificsetofwaveletdecompositionfilters(see%WFILTERS).[C,
8、L]=WAVEDEC(X,N,'wname')returnsthe