资源描述:
《小波变换的matlab实现》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、第4章小波变换的matlab实现11.Matlab中小波种类15种经典类小波:Harr小波、Morlet小波、Mexicanhat小波、Gaussian小波正交小波:db小波、对称小波、Coiflets小波、Meyer小波双正交小波查看命令wavemngr('read',1)2小波分析示例一维连续小波1.coefs=cwt(s,scale,’wname’)2.coefs=cwt(s,scale,’wname’,’plot’)c=cwt(noissin,1:48,'db4','plot');3C=cwt(noissin,2:2:128,’db
2、4’,’plot’)4图形接口方式(GUI)命令:wavemenu567一维离散小波分解命令:dwt格式:[cA1,cD1]=dwt(X,’wname’)[cA1,cD1]=dwt(X,Lo_D,Hi_D)举例:loadleleccum;s=leleccum(1:3920);ls=length(s);[cA1,cD1]=dwt(s,’db1’);8原始信号低频系数高频系数9系数重构命令:upcoef格式:1.Y=upcoef(O,X,’wname’,N)2.Y=upcoef(O,X,’wname’,N,L)3.Y=upcoef(O,X,’L
3、o_R,Hi_R’,N)4.Y=upcoef(O,X,’Lo_R,Hi_R’,N,L)5.Y=upcoef(O,X,’wname’)6.Y=upcoef(O,X,Lo_R,Hi_R)O=‘a’低频,O=‘d’高频10举例:A1=upcoef('a','cA1','db1',1,ls);D1=upcoef('d','cD1','db1',1,ls);subplot(1,2,1);plot(A1);title('ApproximationA1')subplot(1,2,2);plot(D1);title('DetailD1')11逆变换恢复信号
4、命令:idwt格式:1.X=idwt(cA,cD,’wname’)2.X=idwt(cA,cD,Lo_R,Hi_R)3.X=idwt(cA,cD,’wname’,L)4.X=idwt(cA,cD,Lo_R,Hi_R,L)12举例:A0=idwt(cA1,cD1,'db1',ls);13多尺度一维分解命令:wavedec格式:[C,L]=wavedec(X,N,’wname’)[C,L]=wavedec(X,N,Lo_D,Hi_D)14[C,L]=wavedec(s,3,'db1');15低频系数提取命令:appcoef格式:1.A=appc
5、oef(C,L,’wname’,N)2.A=appcoef(C,L,’wname’)3.A=appcoef(C,L,Lo_R,Hi_R,N)4.A=appcoef(C,L,Lo_R,Hi_R)16高频系数提取命令:detcoef格式:1.A=detcoef(C,L,N)2.A=detcoef(C,L)17举例cA3=appcoef(C,L,'db1',3);cD3=detcoef(C,L,3);cD2=detcoef(C,L,2);cD1=detcoef(C,L,1);18重构系数命令:wrcoef格式:1.X=wrcoef(‘type’,
6、C,L,’wname’,N)2.X=wrcoef(‘type’,C,L,Lo_R,Hi_R,N)3.X=wrcoef(‘type’,C,L,’wname’)4.X=wrcoef(‘type’,C,L,Lo_R,Hi_R)type=‘a’低频,type=‘d’高频19A3=wrcoef('a',C,L,'db1',3);D1=wrcoef('d',C,L,'db1',1);D2=wrcoef('d',C,L,'db1',2);D3=wrcoef('d',C,L,'db1',3);20重构原始信号命令:waverec格式:1.X=waverec
7、(C,L,’wname’)2.X=waverec(C,L,Lo_R,Hi_R)例子:A0=waverec(C,L,’db1’);重构最大误差:Err=max(abs(s-A0))2122图形接口方式(GUI)2324252627282.二维离散小波单尺度分解——dwt2格式:1.[cA1,cH1,cV1,cD1]=dwt2(X,’wname’)2.[cA1,cH1,cV1,cD1]=dwt2(X,Lo_D,Hi_D)cA1,cH1水平;cV1垂直;cD1对角应用:loadwbarb;figure(1);image(X);colormap(m
8、ap);colorbar;[cA1,cH1,cV1,cD1]=dwt2(X,’bior3.7’)29重构系数命令:upcoef2格式:1.Y=upcoef2(O,X,’wname