dwtmode

Discrete wavelet transform extension mode

Description

example

dwtmode(mode) sets the signal or image extension mode for both discrete wavelet and wavelet packet transforms to mode. All functions and Wavelet Analyzer app tools involving either the discrete wavelet transform (1-D and 2-D) or wavelet packet transform (1-D and 2-D), use the specified DWT extension mode.

The extension modes provide options for dealing with the problem of border distortion in signal or image analysis. For more information, see Border Effects.

dwtmode or dwtmode('status') display the current mode. If DWTMODE.DEF exists in the current path, the default mode is loaded from DWTMODE.DEF at the start of the MATLAB® session. Otherwise, the file DWTMODE.CFG is used.

st = dwtmode or st = dwtmode('status') display and return the current mode in st.

st = dwtmode('status','nodisp') returns the current mode st and no status or warning text is displayed in the MATLAB command window.

dwtmode('save',mode) saves mode as the new default mode to the file DWTMODE.DEF in the current folder. If DWTMODE.DEF already exists in the current folder, the file is overwritten. The new default mode will be active as default mode in the next MATLAB session.

dwtmode('save') is equivalent to dwtmode('save',CURRENTMODE), where CURRENTMODE represents the current extension mode.

Examples

collapse all

Clear the DWT extension mode global variable, and display the current DWT signal extension mode. If the DWT extension mode global variable does not exist, the default is half-point symmetrization.

clear global
dwtmode
                                                       
*******************************************************
**  DWT Extension Mode: Symmetrization (half-point)  **
*******************************************************
                                                       

Change the extension mode to periodized extension.

dwtmode('per')
 
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!  WARNING: Change DWT Extension Mode  !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                                         
*****************************************
**  DWT Extension Mode: Periodization  **
*****************************************
                                         

Display the current DWT signal extension mode.

dwtmode
                                         
*****************************************
**  DWT Extension Mode: Periodization  **
*****************************************
                                         

Input Arguments

collapse all

DWT extension mode used to extend the input, specified as one of the following values.

mode

DWT Extension Mode

'zpd'

Zero extension

'sp0'

Smooth extension of order 0

'spd' (or 'sp1')

Smooth extension of order 1

'sym' or 'symh'

Symmetric extension (half point): boundary value symmetric replication

'symw'

Symmetric extension (whole point): boundary value symmetric replication

'asym' or 'asymh'

Antisymmetric extension (half point): boundary value antisymmetric replication

'asymw'

Antisymmetric extension (whole point): boundary value antisymmetric replication

'ppd', 'per'

Periodized extension

If the signal length is odd and mode is 'per', an extra sample equal to the last value is added to the right and the extension is performed in 'ppd' mode. If the signal length is even, 'per' is equivalent to 'ppd'. This rule also applies to images.

The DWT associated with the symmetric, smooth, zero, and periodic extension modes are slightly redundant. But the inverse DWT ensures a perfect reconstruction for the extensions mentioned.

Note

dwtmode updates a global variable. Only use dwtmode to change the extension mode. Avoid changing the global variable directly.

Output Arguments

collapse all

DWT extension mode, returned as a character array.

Tips

  • For most wavelet applications, either a periodic extension or symmetric extension works fine.

References

[1] Strang, G., and T. Nguyen. Wavelets and Filter Banks. Wellesley, MA: Wellesley-Cambridge Press, 1996.

See Also

Apps

Functions

Introduced before R2006a