close all;
clear;

typ='db3';
[h_,g_,h,g]=wfilters(typ)

figure('name','diskretne: wavelet h(n) (modrou) a funkcia mierky g(n)(cervenou)');
hold on;
stem(h,'-og')
stem(g,'-.+r')
poceth=length(h)
for j=1:2*poceth
    k=j-poceth;
    sucet=0;
    for n=1:poceth
        if n-2*k>0 & n-2*k<=poceth
            sucet=sucet+h(n)*h(n-2*k)
        end
    end
    autokorelaciah(j)=sucet
    K(j)=2*k
end
figure('name','Ortogonalita h(n) na svoje parne posuny (autokorelacia)');
stem(K,autokorelaciah)
for j=1:2*poceth
    k=j-poceth
    sucet=0
    for n=1:poceth
        if n-2*k>0 & n-2*k<=poceth
            sucet=sucet+h(n)*g(n-2*k)
        end
    end
    kroskorelacia(j)=sucet
    K(j)=2*k
end
figure('name','kroskorelacia h(n) a g(n) (vzajomna ortogonalita)')
stem(K,kroskorelacia)
axis([1-2*poceth,2*poceth,0,1])
