clear all;
close all;
clc;
[a b h g]=wfilters('Db2');
s=[1 2 3 4 -4 -3 -2 -1];
T1=[h 0 0 0 0; 0 0 h 0 0; 0 0 0 0 h; h(3:4) 0 0 0 0 h(1:2); g 0 0 0 0; 0 0 g 0 0; 
    0 0 0 0 g; g(3:4) 0 0 0 0 g(1:2)];
CD1=T1*s'
T2=[h;h(3:4) h(1:2);g;g(3:4) g(1:2)];
CD2=T2*CD1(1:4)
T3=[h(1:2)+h(3:4);g(1:2)+g(3:4)];
CD3=T3*CD2(1:2)

S=[CD3' CD2(3:4)' CD1(5:8)']
C2=inv(T3)*S(1:2)'
C1=inv(T2)*[C2' S(3:4)]'
C0=inv(T1)*[C1' S(5:8)]'

parxD=sum(s.^2);
parxi=sum(S.^2);

if ceil(parxD)==ceil(parxi)
    disp([' Parcevalova teorema plati' ]);
else 
    disp([' Parcevalova teorema neplati' ]);
end

if det(T1) == 0
    disp([' Vektory su ortonormalne' ]);
else 
    disp([' Vektory nie su ortonormalne' ]);
end

