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

    %% Matching Pursuit Dictionary Creation and Vizualization
% This example shows how to create and visualize a dictionary consisting of
% a Haar wavelet down to level 2. 
[mpdict,~,~,longs] = wmpdictionary(100,'lstcpt',{{'haar',2}});

%%
% Use the |longs| output argument to divide the wavelet dictionary 
% by level and type of function (scaling or wavelet). Step through a plot
% of the translated scaling functions and wavelets by level.
for nn = 1:size(mpdict,2)
    if (nn <= longs{1}(1))
        plot(mpdict(:,nn),'k','linewidth',2); 
        grid on;
        xlabel('Translation');
        title('Haar Scaling Function - Level 2');
    elseif (nn>longs{1}(1) && nn<= longs{1}(1)+longs{1}(2))
        plot(mpdict(:,nn),'r','linewidth',2); 
        grid on;
        xlabel('Translation');
        title('Haar Wavelet - Level 2');
    else
        title('Haar Wavelet - Level 1');
        plot(mpdict(:,nn),'b','linewidth',2); 
        grid on;
        title('Haar Wavelet - Level 1');
        xlabel('Translation');
    end
        pause(0.2);
end