Main Content


Wavelet packet functions


    wpfun is a wavelet packet analysis function.


    [wpws,x] = wpfun(wname,num) returns the num+1 wavelet packets associated with the wavelet wname on dyadic intervals of length 2–7. The wavelet packets are evaluated on the grid x.

    [wpws,x] = wpfun(wname,num,prec) uses dyadic intervals of length 2prec.


    collapse all

    Specify the db2 wavelet. Obtain the wavelet packets Wn, for n=0,,7, associated with the wavelet.

    wv = "db2";
    n = 7;
    [wpws,x] = wpfun(wv,7);

    Plot the wavelet packets

    for k=0:n
        title("n = "+num2str(k))

    Input Arguments

    collapse all

    Wavelet, specified as a character vector or string scalar. For more information, see wfilters.

    Index, specified as a nonnegative integer. The wpfun function returns num+1 wavelet packets.

    Data Types: double

    Length of the dyadic interval, specified as a positive integer. The length of the interval is 2prec.

    Data Types: double

    Output Arguments

    collapse all

    Wavelet packets, returned as a matrix. wpws has num+1 rows. The wavelet packets are stored row-wise as [W0; W1; … ; Wnum].

    Grid points where the wavelet packets are evaluated, returned as a real-valued vector.

    More About

    collapse all

    Generating Wavelet Packets

    The computation scheme for wavelet packets generation is easy when using an orthogonal wavelet. You start with the two filters of length 2N, denoted h(n) and g(n), corresponding to the wavelet.

    Next, by induction, define the following sequence of functions (Wn(x) , n = 0,1,2,…) by


    where W0(x) = ϕ (x) is the scaling function and W1(x) = ψ(x) is the wavelet function.

    For example, for the Haar wavelet you have




    The equations become




    W0(x) = ϕ(x) is the haar scaling function and W1(x) = ψ(x) is the haar wavelet, both supported in [0,1].

    Then you can obtain W2 n by adding two 1/2-scaled versions of Wn with distinct supports [0,1/2] and [1/2,1], and obtain W2n+1 by subtracting the same versions of Wn.

    Starting from more regular original wavelets, using a similar construction, you obtain smoothed versions of this system of W-functions, all with support in the interval [0, 2N-1].


    [1] Coifman, R.R., and M.V. Wickerhauser. “Entropy-Based Algorithms for Best Basis Selection.” IEEE Transactions on Information Theory 38, no. 2 (March 1992): 713–18.

    [2] Jaffard, Stéphane, Yves Meyer, and Robert D. Ryan. Wavelets: Tools for Science & Technology. Philadelphia: Society for Industrial and Applied Mathematics, 2001.

    [3] Wickerhauser, M.V. "INRIA lectures on wavelet packet algorithms." Proceedings ondelettes et paquets d'ondes, 17–21 June 1991, Rocquencourt, France, pp. 31–99.

    [4] Wickerhauser, Mladen Victor. Adapted Wavelet Analysis from Theory to Software. Wellesley, MA: A.K. Peters, 1994.

    Version History

    Introduced before R2006a

    See Also