% example for pseudospectral computations
% computation of norms of iterates of A and S

K=400;
P=zeros(4,K);
Q=zeros(4,K);

for N=[16 32 48 64]
    AA=toeplitz([0 1/4 zeros(1,N-2)],[0 1 zeros(1,N-2)]);
    SS=toeplitz([0 1/2 zeros(1,N-2)],[0 1/2 zeros(1,N-2)]);

    for k=1:K
        P(N/16,k)=norm(AA^k);
        Q(N/16,k)=norm(SS^k);
    end

end
figure
semilogy(1:K,P,'-r')
hold on
semilogy(1:K,Q,'-b')
semilogy(1:K,1.25.^(1:K),'-k')
axis([0 400 10^-5 10^15])
hold off