function [t,fii,tp,psi]=skaalaf2(h,n)
%
% h gives the filter coefficients
% n is the number of iterations
% length of the vectors fii and psi 
% approximately doubles at each iteration
%
     k=length(h);
     in=2*(1:(k/2));
     h0=h(in-1);
     h1=h(in);
     fii=2*h;
     in=1:k;
     aq=(-1).^(in-1);
     g=h(k:-1:1).*aq;
     psi=2*g;
     for j=1:n
        ca=2*conv(fii,h0);
        cb=2*conv(fii,h1);
        fii=reshape([ca;cb],1,2*length(ca));
        ca=2*conv(psi,h0);
        cb=2*conv(psi,h1);
        psi=reshape([ca;cb],1,2*length(ca));
     end
     fii=[fii,zeros(1,k-1)];
     psi=[psi,zeros(1,k-1)];
     m=length(fii);
     t=linspace(0,k-1,m);
     tp=t-k+2;

