小波分析:db小波的分解与重构
最近在利用行波测距中使用到了小波变换的模极大值提取行波波头的时间,苦于公开资源太少,无从下手。最终经过学习,有所所获,希望可以帮助到有需要的同学。
贴一段matlab的代码:
%--------------小波变换-------------------%
[c1,l1]=wavedec(uf,8,'db8');%多尺度一维小波分解函数。其中C为分解结构变量,L为各分解结构以及原始信号长度变量,X为原始信号,N为分解层度,’wname’为小波类型。
a8=wrcoef('a',c1,l1,'db8',8);%一维小波系数单支重构函数。其中,当’type’ = ’a’时重构近似序列,当’type’ = ’d’时重构高频系数;C,L,’wname’,N含义同上
d8=wrcoef('d',c1,l1,'db8',8);
d7=wrcoef('d',c1,l1,'db8',7);
d6=wrcoef('d',c1,l1,'db8',6);
d5=wrcoef('d',c1,l1,'db8',5);
d4=wrcoef('d',c1,l1,'db8',4);
d3=wrcoef('d',c1,l1,'db8',3);
d2=wrcoef('d',c1,l1,'db8',2);
d1=wrcoef('d',c1,l1,'db8',1);
subplot(10,1,1);plot(t,uf1);ylabel('s');
title('Decomposition at level 8:s = a8+d8+d7+d6+d5+d4+d3+d2+d1')
subplot(10,1,2);plot(a8);ylabel('a8');
subplot(10,1,3);plot(d8);ylabel('d8');
subplot(10,1,4);plot(d7);ylabel('d7');
subplot(10,1,5);plot(d6);ylabel('d6');
subplot(10,1,6);plot(d5);ylabel('d5');
subplot(10,1,7);plot(d4);ylabel('d4');
subplot(10,1,8);plot(d3);ylabel('d3');
subplot(10,1,9);plot(d2);ylabel('d2');
subplot(10,1,10);plot(d1);ylabel('d1');