www.gusucode.com > wavelet 源码程序 matlab案例代码 > wavelet/DepthAndPositionInWaveletPacketTreeExample.m

    %% Depth and Position in Wavelet Packet Tree
% Create a binary wavelet packet tree with three levels.

% Copyright 2015 The MathWorks, Inc.

Ord = 2;
Lev = 3;
T = ntree(Ord,Lev);
%%
% Plot the binary wavelet packet tree.
plot(T)
%%
% Obtain the indices of the nodes in linear order.
idx = allnodes(T);
%%
% Conver the indices to depth-position format.
[depth,pos] = ind2depo(Ord,idx);
table(depth,pos)