📄 小波滤波器构造和消噪程序 - dinga's blog.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0038)http://www.dinga.cn/article.asp?id=307 -->
<HTML lang=UTF-8 xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>小波滤波器构造和消噪程序 - Dinga's Blog</TITLE>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<META http-equiv=Content-Language content=UTF-8>
<META content=all name=robots>
<META content=dinga@ewyu.com,dinga name=author>
<META content="Dinga's Blog CopyRight 2004-008" name=Copyright>
<META
content="Dinga,blog,LabVIEW,ICA,Matlab,wavelet,Modal,Modal Analysis,Modal Parameter,signal processing,独立分量,独立分量分析,小波,小波分析,小波神经网,模态,模态分析,模态参数识别,信号处理"
name=keywords>
<META content="Dinga's Blog - -Happy study-Enjoy life-Everyday is a New day!"
name=description><LINK title="订阅 Dinga's Blog - 小波分析 所有文章(rss2)"
href="http://www.dinga.cn/feed.asp?cateID=17" type=application/rss+xml
rel=alternate><LINK title="订阅 Dinga's Blog - 小波分析 所有文章(atom)"
href="http://www.dinga.cn/atom.asp?cateID=17" type=application/atom+xml
rel=alternate><LINK rev=stylesheet media=all
href="小波滤波器构造和消噪程序 - Dinga's Blog.files/global.css" type=text/css
rel=stylesheet><!--全局样式表--><LINK rev=stylesheet media=all
href="小波滤波器构造和消噪程序 - Dinga's Blog.files/layout.css" type=text/css
rel=stylesheet><!--层次样式表--><LINK rev=stylesheet media=all
href="小波滤波器构造和消噪程序 - Dinga's Blog.files/typography.css" type=text/css
rel=stylesheet><!--局部样式表--><LINK rev=stylesheet media=all
href="小波滤波器构造和消噪程序 - Dinga's Blog.files/link.css" type=text/css rel=stylesheet><!--超链接样式表--><LINK rev=stylesheet media=all
href="小波滤波器构造和消噪程序 - Dinga's Blog.files/editor.css" type=text/css
rel=stylesheet><!--UBB编辑器代码--><LINK href="favicon.ico" type=image/x-icon
rel=icon><LINK href="favicon.ico" type=image/x-icon rel="shortcut icon">
<SCRIPT src="小波滤波器构造和消噪程序 - Dinga's Blog.files/common.js"
type=text/javascript></SCRIPT>
<!--<script type="text/javascript" src="common/nicetitle.js"></script>-->
<META content="MSHTML 6.00.2900.3268" name=GENERATOR></HEAD>
<BODY onkeydown=PressKey() onload=initJS()><A accessKey=i
href="http://www.dinga.cn/default.asp"></A><A accessKey=z
href="javascript:history.go(-1)"></A>
<DIV id=container><!--顶部-->
<DIV id=header><!--广告开始 <div style="float:right;width:480px;padding:0;margin:10px 0 0 0; border:0;"> <script type="text/JavaScript">var alimama_pid="mm_10286735_347515_527001";var alimama_titlecolor="37499C";var alimama_descolor ="5892CB";var alimama_bgcolor="EDF9F7";var alimama_bordercolor="D6E9FC";var alimama_linkcolor="5768AC";var alimama_bottomcolor="FFFFFF";var alimama_anglesize="4";var alimama_bgpic="0";var alimama_icon="1";var alimama_sizecode="12";var alimama_width=468;var alimama_height=60;var alimama_type=2;</script><script src="http://p.alimama.com/inf.js" type="text/javascript"></script> </div> 广告结束-->
<DIV id=blogname>Dinga's Blog
<DIV id=blogTitle>-Happy study-Enjoy life-Everyday is a New day!</DIV></DIV>
<DIV id=menu>
<DIV id=Left></DIV>
<DIV id=Right></DIV>
<UL>
<LI class=menuL></LI>
<LI><A class=menuA title=日志首页
href="http://www.dinga.cn/default.asp">Index</A></LI>
<LI class=menuDiv></LI>
<LI><A class=menuA title=标签云集 href="http://www.dinga.cn/tag.asp">Tags</A></LI>
<LI class=menuDiv></LI>
<LI><A class=menuA title=GuestBook
href="http://www.dinga.cn/LoadMod.asp?plugins=GuestBookForPJBlog">GuestBook</A></LI>
<LI class=menuDiv></LI>
<LI><A class=menuA title=资源下载
href="http://www.dinga.cn/LoadMod.asp?plugins=Devildown">Resource</A></LI>
<LI class=menuDiv></LI>
<LI><A class=menuA title=友情链接
href="http://www.dinga.cn/bloglink.asp">Links</A></LI>
<LI class=menuDiv></LI>
<LI><A class=menuA title=""
href="http://www.dinga.cn/rili.htm">Calendar</A></LI>
<LI class=menuR></LI></UL></DIV></DIV><!--内容-->
<DIV id=Tbody>
<DIV id=mainContent>
<DIV id=innermainContent>
<DIV id=mainContent-topimg></DIV>
<DIV class=content-width id=Content_ContentList><A accessKey=B
href="http://www.dinga.cn/article.asp?id=307#body" name=body></A>
<DIV class=pageContent>
<DIV style="FLOAT: right; WIDTH: auto"><A title=订阅所有小波分析的日志 accessKey=O
href="http://www.dinga.cn/feed.asp?cateID=17" target=_blank><IMG
style="MARGIN-BOTTOM: -1px" alt=订阅所有小波分析的日志
src="小波滤波器构造和消噪程序 - Dinga's Blog.files/rss.png" border=0> 订阅</A> | <A
title="上一篇日志: 2维小波变换经典程序" accessKey=,
href="http://www.dinga.cn/article.asp?id=306"><IMG alt=""
src="小波滤波器构造和消噪程序 - Dinga's Blog.files/Cprevious.gif" border=0> 上一篇</A> | <A
title="下一篇日志: 消失矩作用的程序" accessKey=.
href="http://www.dinga.cn/article.asp?id=308"><IMG alt=""
src="小波滤波器构造和消噪程序 - Dinga's Blog.files/Cnext.gif" border=0> 下一篇</A> </DIV><IMG
style="MARGIN: 0px 2px -4px 0px" alt=""
src="小波滤波器构造和消噪程序 - Dinga's Blog.files/14.gif"> <STRONG><A title=查看所有小波分析的日志
href="http://www.dinga.cn/default.asp?cateID=17">小波分析</A></STRONG> </DIV>
<DIV class=Content>
<DIV class=Content-top>
<DIV class=ContentLeft></DIV>
<DIV class=ContentRight></DIV>
<H1 class=ContentTitle><STRONG>小波滤波器构造和消噪程序</STRONG></H1>
<H2 class=ContentAuthor>作者:dinga 日期:2007-05-11</H2></DIV>
<DIV class=Content-Info>
<DIV class=InfoOther>字体大小: <A accessKey=1
href="javascript:SetFont('12px')">小</A> <A accessKey=2
href="javascript:SetFont('14px')">中</A> <A accessKey=3
href="javascript:SetFont('16px')">大</A></DIV>
<DIV class=InfoAuthor><IMG style="MARGIN: 0px 2px -6px 0px" alt=""
src="小波滤波器构造和消噪程序 - Dinga's Blog.files/hn2_sunny.gif"><IMG alt=""
src="小波滤波器构造和消噪程序 - Dinga's Blog.files/hn2_t_sunny.gif"> <IMG
style="MARGIN: 0px 2px -1px 0px" alt=""
src="小波滤波器构造和消噪程序 - Dinga's Blog.files/level3.gif"> </DIV></DIV>
<DIV class=Content-body id=logPanel>1.重构 <BR>
<DIV class=UBBPanel>
<DIV class=UBBTitle><IMG style="MARGIN: 0px 2px -3px 0px" alt=程序代码
src="小波滤波器构造和消噪程序 - Dinga's Blog.files/code.gif"> 程序代码</DIV>
<DIV
class=UBBContent><BR>% mallet_wavelet.m <BR>% 此函数用于研究Mallet算法及滤波器设计 <BR>% 此函数仅用于消噪 <BR><BR>a=pi/8; %角度赋初值 <BR><BR>b=pi/8; <BR><BR>%低通重构FIR滤波器h0(n)冲激响应赋值 <BR>h0=cos(a)*cos(b); <BR>h1=sin(a)*cos(b); <BR>h2=-sin(a)*sin(b); <BR>h3=cos(a)*sin(b); <BR><BR>low_construct=[h0,h1,h2,h3]; <BR><BR>L_fre=4; %滤波器长度 <BR>low_decompose=low_construct(end:-1:1); %确定h0(-n),低通分解滤波器 <BR>for i_high=1:L_fre; %确定h1(n)=(-1)^n,高通重建滤波器 <BR> if(mod(i_high,2)==0); <BR> coefficient=-1; <BR> else <BR> coefficient=1; <BR> end <BR><BR> high_construct(1,i_high)=low_decompose(1,i_high)*coefficient; <BR><BR>end <BR><BR>high_decompose=high_construct(end:-1:1); %高通分解滤波器h1(-n) <BR><BR>L_signal=100; %信号长度 <BR><BR>n=1:L_signal; %信号赋值 <BR><BR>f=10; <BR>t=0.001; <BR>y=10*cos(2*pi*50*n*t).*exp(-20*n*t); <BR><BR>figure(1); <BR>plot(y); <BR>title('原信号'); <BR>check1=sum(high_decompose); %h0(n)性质校验 <BR>check2=sum(low_decompose); <BR>check3=norm(high_decompose); <BR>check4=norm(low_decompose); <BR><BR>l_fre=conv(y,low_decompose); %卷积 <BR><BR>l_fre_down=dyaddown(l_fre); %抽取,得低频细节 <BR><BR>h_fre=conv(y,high_decompose); <BR><BR>h_fre_down=dyaddown(h_fre); %信号高频细节 <BR><BR>figure(2); <BR>subplot(2,1,1) <BR>plot(l_fre_down); <BR>title('小波分解的低频系数'); <BR><BR>subplot(2,1,2); <BR>plot(h_fre_down); <BR>title('小波分解的高频系数'); <BR><BR>l_fre_pull=dyadup(l_fre_down); %0差值 <BR><BR>h_fre_pull=dyadup(h_fre_down); <BR><BR>l_fre_denoise=conv(low_construct,l_fre_pull); <BR><BR>h_fre_denoise=conv(high_construct,h_fre_pull); <BR><BR><BR>l_fre_keep=wkeep(l_fre_denoise,L_signal); %取结果的中心部分,消除卷积影响 <BR><BR>h_fre_keep=wkeep(h_fre_denoise,L_signal); <BR><BR>sig_denoise=l_fre_keep+h_fre_keep; %信号重构 <BR><BR>compare=sig_denoise-y; %与原信号比较 <BR>figure(3); <BR><BR> <BR><BR>subplot(3,1,1) <BR><BR>plot(y); <BR><BR>ylabel('y'); %原信号 <BR><BR> <BR><BR>subplot(3,1,2); <BR><BR>plot(sig_denoise); <BR><BR>ylabel('sig\_denoise'); %重构信号 <BR><BR> <BR><BR>subplot(3,1,3); <BR><BR>plot(compare); <BR><BR>ylabel('compare'); %原信号与消噪后信号的比较 <BR><BR></DIV></DIV><BR><BR><SPAN
style="COLOR: red">2.消噪</SPAN><BR>
<DIV class=UBBPanel>
<DIV class=UBBTitle><IMG style="MARGIN: 0px 2px -3px 0px" alt=程序代码
src="小波滤波器构造和消噪程序 - Dinga's Blog.files/code.gif"> 程序代码</DIV>
<DIV
class=UBBContent>% mallet_wavelet.m <BR><BR>% 此函数用于研究Mallet算法及滤波器设计 <BR><BR>% 此函数用于消噪处理 <BR><BR> <BR><BR>%角度赋值 <BR><BR>%此处赋值使滤波器系数恰为db9 <BR><BR> <BR><BR>%分解的高频系数采用db9较好,即它的消失矩较大 <BR><BR>%分解的有用信号小波高频系数基本趋于零 <BR><BR>%对于噪声信号高频分解系数很大,便于阈值消噪处理 <BR><BR> <BR><BR>[l,h]=wfilters('db10','d'); <BR><BR> <BR><BR>low_construct=l; <BR><BR> <BR><BR>L_fre=20; %滤波器长度 <BR><BR> <BR><BR> <BR><BR>low_decompose=low_construct(end:-1:1); %确定h0(-n),低通分解滤波器 <BR><BR> <BR><BR>for i_high=1:L_fre; %确定h1(n)=(-1)^n,高通重建滤波器 <BR><BR> <BR><BR> if(mod(i_high,2)==0); <BR><BR> coefficient=-1; <BR><BR> else <BR><BR> coefficient=1; <BR><BR> end <BR><BR> <BR><BR> high_construct(1,i_high)=low_decompose(1,i_high)*coefficient; <BR><BR>end <BR><BR> <BR><BR>high_decompose=high_construct(end:-1:1); %高通分解滤波器h1(-n) <BR><BR> <BR><BR> <BR><BR> <BR><BR>L_signal=100; %信号长度 <BR><BR> <BR><BR>n=1:L_signal; %原始信号赋值 <BR><BR>f=10; <BR><BR>t=0.001; <BR><BR>y=10*cos(2*pi*50*n*t).*exp(-30*n*t); <BR><BR> <BR><BR>zero1=zeros(1,60); %信号加噪声信号产生 <BR><BR>zero2=zeros(1,30); <BR><BR>noise=[zero1,3*(randn(1,10)-0.5),zero2]; <BR><BR>y_noise=y+noise; <BR><BR> <BR><BR>figure(1); <BR><BR>subplot(2,1,1); <BR><BR>plot(y); <BR><BR>title('原信号'); <BR><BR> <BR><BR>subplot(2,1,2); <BR><BR>plot(y_noise); <BR><BR>title('受噪声污染的信号'); <BR><BR> <BR><BR>check1=sum(high_decompose); %h0(n),性质校验 <BR><BR>check2=sum(low_decompose); <BR><BR>check3=norm(high_decompose); <BR><BR>check4=norm(low_decompose); <BR><BR> <BR><BR>l_fre=conv(y_noise,low_decompose); %卷积 <BR><BR>l_fre_down=dyaddown(l_fre); %抽取,得低频细节 <BR><BR> <BR><BR>h_fre=conv(y_noise,high_decompose); <BR><BR>h_fre_down=dyaddown(h_fre); %信号高频细节 <BR><BR> <BR><BR> <BR><BR>figure(2); <BR><BR>subplot(2,1,1) <BR><BR>plot(l_fre_down); <BR><BR>title('小波分解的低频系数'); <BR><BR> <BR><BR>subplot(2,1,2); <BR><BR>plot(h_fre_down); <BR><BR>title('小波分解的高频系数'); <BR><BR> <BR><BR> <BR><BR>% 消噪处理 <BR><BR> for i_decrease=31:44; <BR><BR> <BR><BR> if abs(h_fre_down(1,i_decrease))>=0.000001 <BR><BR> h_fre_down(1,i_decrease)=(10^-7); <BR><BR> end <BR><BR> <BR><BR> end <BR><BR> <BR><BR> <BR><BR>l_fre_pull=dyadup(l_fre_down); %0差值 <BR><BR>h_fre_pull=dyadup(h_fre_down); <BR><BR> <BR><BR> <BR><BR> <BR><BR>l_fre_denoise=conv(low_construct,l_fre_pull); <BR><BR>h_fre_denoise=conv(high_construct,h_fre_pull); <BR><BR> <BR><BR>l_fre_keep=wkeep(l_fre_denoise,L_signal); %取结果的中心部分,消除卷积影响 <BR><BR>h_fre_keep=wkeep(h_fre_denoise,L_signal); <BR><BR> <BR><BR>sig_denoise=l_fre_keep+h_fre_keep; %消噪后信号重构 <BR><BR> <BR><BR>%平滑处理 <BR><BR> <BR><BR>for j=1:2 <BR><BR>for i=60:70; <BR><BR> sig_denoise(i)=sig_denoise(i-2)+sig_denoise(i+2)/2; <BR><BR>end; <BR><BR>end; <BR><BR> <BR><BR>compare=sig_denoise-y; %与原信号比较 <BR><BR> <BR><BR>figure(3); <BR><BR> <BR><BR>subplot(3,1,1) <BR><BR>plot(y); <BR><BR>ylabel('y'); %原信号 <BR><BR> <BR><BR>subplot(3,1,2); <BR><BR>plot(sig_denoise); <BR><BR>ylabel('sig\_denoise'); %消噪后信号 <BR><BR> <BR><BR>subplot(3,1,3); <BR><BR>plot(compare);ylabel('compare'); %原信号与消噪后信号的比较<BR></DIV></DIV><BR><BR></DIV>
<DIV class=Content-body><IMG style="MARGIN: 4px 2px -4px 0px" alt=""
src="小波滤波器构造和消噪程序 - Dinga's Blog.files/From.gif"><STRONG>文章来自:</STRONG> <A
href="http://waveletlegend.spaces.live.com/" target=_blank>转贴</A><BR><IMG
style="MARGIN: 4px 2px -4px 0px" alt=""
src="小波滤波器构造和消噪程序 - Dinga's Blog.files/icon_trackback.gif"><STRONG>引用通告地址:</STRONG>
<SPAN id=tburl><A href="javascript:showTrackBack()">查看引用地址</A></SPAN><BR>
<SCRIPT type=text/javascript>
// 引用地址显示
function showTrackBack(){
var tb_url_text
tb_url_text = '<a href="http://www.dinga.cn/trackback.asp?tbID=307&key=123456" target="_blank">http://www.dinga.cn/trackback.asp?tbID=307&key=123456</a>'
document.getElementById("tburl").innerHTML = tb_url_text
}
</SCRIPT>
<IMG style="MARGIN: 4px 2px -4px 0px" alt=""
src="小波滤波器构造和消噪程序 - Dinga's Blog.files/tag.gif"><STRONG>Tags:</STRONG> <A
href="http://www.dinga.cn/default.asp?tag=%E5%B0%8F%E6%B3%A2">小波</A><A
style="DISPLAY: none" href="http://technorati.com/tag/小波" rel=tag>小波</A> <A
href="http://www.dinga.cn/default.asp?tag=%E6%BB%A4%E6%B3%A2%E5%99%A8">滤波器</A><A
style="DISPLAY: none" href="http://technorati.com/tag/滤波器" rel=tag>滤波器</A> <A
href="http://www.dinga.cn/default.asp?tag=%E5%B0%8F%E6%B3%A2%E6%B6%88%E5%99%AA">小波消噪</A><A
style="DISPLAY: none" href="http://technorati.com/tag/小波消噪" rel=tag>小波消噪</A>
<BR></DIV>
<DIV class=Content-bottom>
<DIV class=ContentBLeft></DIV>
<DIV class=ContentBRight></DIV>评论: 1 | 引用: 0 | 查看次数: 816 </DIV></DIV></DIV><A
accessKey=C href="http://www.dinga.cn/article.asp?id=307#comm_top"
name=comm_top></A>
<DIV class=pageContent>
<DIV class=page style="FLOAT: right">
<UL>
<LI class=pageNumber><STRONG>1</STRONG></LI></UL></DIV></DIV>
<DIV class=comment>
<DIV class=commenttop><A href="javascript:addQuote('颖','commcontent_372')"
name=comm_372><IMG style="MARGIN: 0px 4px -3px 0px" alt=""
src="小波滤波器构造和消噪程序 - Dinga's Blog.files/icon_quote.gif" border=0></A><A
href="http://www.dinga.cn/member.asp?action=view&memName=%E9%A2%96"><STRONG>颖</STRONG></A>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -