%% Subband Ordering For Asymmetric Tree Structure Using Dyadic Analysis Filter Bank
% Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent step syntax. For example, myObject(x) becomes step(myObject,x).
% Sampling frequency 1 kHz input length 1024

t = 0:.001:1.023; 
x = square(2*pi*30*t);
xn = x' + 0.08*randn(length(x),1);

%
% Default asymmetric structure with order 3 extremal phase wavelet

dydan = dsp.DyadicAnalysisFilterBank;
Y = dydan(xn);

%
% Level 2 yields 3 subbands (two detail-one approximation) Nyquist frequency is 500 Hz

D1 = Y(1:512); % subband approx. [250, 500] Hz 
D2 = Y(513:768); % subband approx. [125, 250] Hz
Approx = Y(769:1024); % subband approx. [0,125] Hz

% Copyright 2012 The MathWorks, Inc.