解读matlab之小波库函数

发布时间 : 星期四 文章解读matlab之小波库函数更新完毕开始阅读

图14

wavedec函数中的核心函数为dwt函数,作多少尺度的分解就调用几次dwt函数。

4 waverec函数

waverec函数是多尺度一维离散小波重构函数。 waverec performs a multilevel one-dimensional wavelet reconstruction using either a specific wavelet ('wname', see wfilters) or specific reconstruction filters (Lo_R and Hi_R). waverec is the inverse function of wavedec in the sense that the abstract statement waverec(wavedec(X,N,'wname'),'wname') returns X.

X = waverec(C,L,'wname') reconstructs the signal X based on the multilevel wavelet decomposition structure [C,L] and wavelet 'wname'. (For information about the decomposition structure, see wavedec.) X = waverec(C,L,Lo_R,Hi_R) reconstructs the signal X as above, using the reconstruction filters you specify. Lo_R is the reconstruction low-pass filter and Hi_R is the reconstruction high-pass filter. Note that X = waverec(C,L,'wname') is equivalent to X = appcoef(C,L,'wname',0).

waverec函数中的核心函数是appcoef函数,故先要研究下appcoef函数函数的工作过程。

5 appcoef函数

appcoef函数为提取一维离散小波近似分量函数。

appcoef is a one-dimensional wavelet analysis function.

appcoef computes the approximation coefficients of a one-dimensional signal.

9

A = appcoef(C,L,'wname',N) computes the approximation coefficients at level N using the wavelet decomposition structure [C,L] (see wavedec for more information).

'wname' is a string containing the wavelet name. Level N must be an integer such that 0≤N≤length(L)-2.

A = appcoef(C,L,'wname') extracts the approximation coefficients at the last level: length(L)-2.

Instead of giving the wavelet name, you can give the filters.

For A = appcoef(C,L,Lo_R,Hi_R) or A = appcoef(C,L,Lo_R,Hi_R,N), Lo_R is the reconstruction low-pass filter and Hi_R is the reconstruction high-pass filter (see wfilters for more information).

因为小波重构的过程实际上就是得到‘0尺度’下的近似分量。故waverec函数可以说是appcoef函数功能的一部分。

appcoef函数中的两个主要函数是detcoef函数和idwt函数。 下面先看一下detcoef函数。

detcoef函数为提取一维离散小波细节分量函数。我们看一下wavedec函数,wavedec函数的返回值为c,l。 detcoef函数是为了更方便地取出c中的细节分量数据,实现过程简单。

appcoef函数可以得到任意尺度下的近似分量数据。 下图是wavedec函数和waverec函数的简单应用程序。

clear; load noissin; x=noissin(1:7); [c,l]=wavedec(x,1,'db2') x1= clear; load noissin; s=noissin(1:7); [ca1,cd1] = dwt(s,'db2'); ss = idwt(ca1,cd1,'db2'); 图15

10

图16

观察图13,它出现了多出一个输出点的情况。而图16中就不存在了。原因简单,idwt函数返回的细节分量和近似分量的项数均为floor((N+4-1)/2)(设小波为db2小波,N为原始数据长度)。易知N=7和N=8两种情况下的项数均为5,这时如图12中所示程序调用idwt函数ss=idwt(ca1,cd1,'db2'),idwt显然无法判别原始数据长度。故会出现多一点的情况。实际上前人早已考虑到这一点,idwt函数中可以加入数据长度这个参数。在图15中的wavedec函数内部调用idwt函数时即考虑了这个问题。

6 upwlev函数

upwlev函数是单尺度一维离散小波分析的重构函数。该函数是在wavedec函数的分解作用下向上一层重构。没有多大作用。下列程序可以比较直观地说明它的作用。

load sumsin; s = sumsin; [c,l] = wavedec(s,3,'db1'); subplot(311); plot(s); subplot(312); plot(c); [nc,nl] = upwlev(c,l,'db1'); subplot(313); plot(nc);

图17

11

图18

7 wrcoef函数

wrcoef函数用于对一维小波变换进行单支重构,这包括两种情况。 第一种情况:令细节分量为0,进行重构。 第二种情况:令近似分量为0,进行重构。

两种情况均可以选择在那个尺度下开始。此函数貌似用处也不大。

8 upcoef函数

该函数可用于得到各个尺度下的尺度函数和小波函数。

9 ddencmp函数

自动生成小波消噪或压缩处理的阈值处理方案。 调用方式:[THR,SORH,KEEPAPP,CRIT] = ddencmp(IN1,IN2,X)自动生成信号x的小波(或小波包)消噪或压缩的阈值选取方案。 输入参数x为一维或二维的信号向量或矩阵。

输入参数IN1指定处理的目的是压缩还是消噪,可选值为IN1=’den’,为信号消噪;IN1=’cmp’,为信号压缩。

输入参数IN2可选值为IN2=’wv’,使用小波分解;IN2=’wp’,使用小波包分解。 输出参数THR为函数选择的阈值。

输出参数SORH为函数选择的阈值使用方式,可选值为SORH=s,为软阈值;SORH=h,为硬阈值。

输出参数CRIT为使用小波包分解时选取的熵函数类型。 下面以下图所示程序为例分析这个函数。

12

联系合同范文客服:xxxxx#qq.com(#替换为@)