Main Content

wpthcoef

Wavelet packet coefficients thresholding

    Description

    wpthcoef is a denoising and compression utility for one- and two-dimensional wavelet packet trees.

    wpt = wpthcoef(T,keepapp,sorh,thr) returns the hard or soft thresholding, indicated by sorh, of the coefficients in the wavelet packet tree T. thr is the threshold value. keepapp indicates whether to threshold the approximation coefficients.

    example

    Examples

    collapse all

    Load a signal.

    load noisdopp

    Obtain the wavelet packet tree corresponding to the wavelet packet decomposition of the signal at level 3. Use the db1 wavelet. Plot the tree.

    wpt = wpdec(noisdopp,3,"db1");
    fig = plot(wpt);

    Figure contains 2 axes objects and other objects of type uimenu. Axes object 1 with title Tree Decomposition contains 29 objects of type line, text. Axes object 2 with title data for node: 0 or (0,0). contains an object of type line.

    Apply a hard threshold of 2 to the wavelet coefficients. Do not threshold the approximation coefficients.

    thr = 2;
    sorh = "h";
    keepapp = 1;
    wptNew = wpthcoef(wpt,keepapp,sorh,thr);

    Obtain the wavelet coefficients at node depth-position (3,7) from both trees.

    dp = [3 7];
    coeffsOrig = read(wpt,"cfs",dp);
    coeffsNew = read(wptNew,"cfs",dp);

    Plot the coefficients.

    tiledlayout(2,1)
    nexttile
    plot(coeffsOrig)
    title("Original Coefficients")
    nexttile
    plot(coeffsNew)
    title("Coefficients After Thresholding")

    Figure contains 2 axes objects. Axes object 1 with title Original Coefficients contains an object of type line. Axes object 2 with title Coefficients After Thresholding contains an object of type line.

    Input Arguments

    collapse all

    Wavelet packet tree, specified as a wptree object.

    Threshold approximation coefficients logical which determines whether to keep or threshold the approximation coefficients, specified as a numeric or logical 1 (true) or 0 (false).

    • 0 — Threshold approximation coefficients

    • 1 — Keep approximation coefficients

    Type of thresholding to perform:

    • "s" — Soft thresholding

    • "h" — Hard thresholding

    For more information, see wthresh.

    Threshold value, specified as a positive real number.

    Output Arguments

    collapse all

    Wavelet packet tree, returned as a wptree object.

    Version History

    Introduced before R2006a