function hh = hhat(n) TH=[];LL=[];HH=[]; for th = 0:.01:1 tha = repmat(th,n-1,1); hh = zeros(n); for i=1:n for j=i+1:n x = 1; for k=i:j-1 x = x * tha(k); end hh(i,j) = x; end end hh = hh + eye(n) A1=sqrt(hh); L2=max(sqrt(eig(A1'*A1))); TH(end+1)=th; LL(end+1)=L2; HH(end+1)=sum(hh(1,:)); end plot(TH,LL,'b') r = 1./(1-sqrt(TH)); hold on plot(TH,HH,'r') return