N0 := 8; N1 := N0 + 4; # Symmetry conditions: n := 'n'; for n from 0 to N0/2-1 do h0(N0-1-n) := h0(n); od; n := 'n'; for n from 0 to N1/2-1 do h1(N1-1-n) := h1(n); od; # filter H0 n := 'n'; H0 := sum(h0(n)*z^n,n=0..(N0-1)); # filter H1 n := 'n'; H1 := sum(h1(n)*z^n,n=0..(N1-1)); # ---------- balancing conditions ---------- P := z^3+z^2+z+1; V1 := 1; V2 := (3-(z^4))/2; V3 := (15-10*(z^4)+3*(z^8))/8; V4 := (35 - 35*(z^4) + 21*(z^8) - 5*(z^12))/16; R1 := expand(rem(H0+V1*H1,P^1,z)); R2 := expand(rem(H0+V2*H1,P^2,z)); R3 := expand(rem(H0+V3*H1,P^3,z)); R4 := expand(rem(H0+V4*H1,P^4,z)); interface(screenwidth=300); writeto(`eqs`); lprint(`// Balancing Conditions`); k := 'k': for k from 0 to 20 do lprint(coeff(R2,z,k),`,`); od; # ---------- orthogonality conditions ---------- H0H0 := expand(collect(H0*subs(z=1/z,H0),z)): H1H1 := expand(collect(H1*subs(z=1/z,H1),z)): H0H1 := expand(collect(H0*subs(z=1/z,H1),z)): lprint(`// Self Orthogonality Conditions `); k := 'k': for k from 1 to 15 do lprint(coeff(H0H0,z,4*k),`,`); lprint(coeff(H1H1,z,4*k),`,`); od; lprint(`// Cross Orthogonality Conditions `); k := 'k': for k from -15 to 15 do lprint(coeff(H0H1,z,4*k),`,`); od; # ---------- normalization conditions ---------- nor0 := coeff(expand(H0H0),z,0) - 1/2: nor1 := coeff(expand(H1H1),z,0) - 1/2: norA := subs(z=1,expand(H0)) - 1: norB := subs(z=1,expand(H1)) - 1: lprint(`// Normalizations`); lprint(norA,`,`); lprint(norB,`,`); lprint(nor0,`,`); lprint(nor1,`;`); # note: put a semicolon at the end of the last equation writeto(terminal); interface(screenwidth=80);