Paolo added file fig2.m  almost 9 years ago

Commit id: 2dfabbce38693709f5b83d608f4623259507f467

deletions | additions      

         

clear  clc  n=4;  R = [0 3 4 5];  P =1/16*[1 13 1 1;13 1 1 1;1 1 13 1; 1 1 1 13];  mmax=20  id = 1;  mrange = 0.00001:.01:mmax;  for m=mrange    for i = 1:1:n  for j = 1:1:n  H(i,j) = 2^( -m*R(j) ) *P(j,i);  H1(i,j) = 2^( -R(j) ) *P(j,i);  end  end    t(id) = -1/m * log (max(eig(H)))/log(2);  s(id) = max(eig(H))^(1/m);    id=id+1;    end  figure(1)  plot( mrange, t , 'r' , 'LineWidth', 2 )  hold on  mrange1 = 2:.001:mmax;  plot( mrange1, -1./mrange1 .* log( P(1,1) ./ 2.^( R(1) * mrange1))/log(2) , 'k--' , 'LineWidth', 2 )  grid on  axis([0 mrange(end) 0 3])  set(gca,...  'Units','normalized',...  'YTick',0:.5:3,...  'XTick',0:5:mrange(end),...  'FontUnits','points',...  'FontWeight','normal',...  'FontSize',12,...  'FontName','Times')  ylabel({'T(m)'},...  'FontUnits','points',...  'interpreter','tex',...  'FontSize',12,...  'FontName','Times')  xlabel('m',...  'FontUnits','points',...  'interpreter','tex',...  'FontWeight','normal',...  'FontSize',12,...  'FontName','Times')  h_legend=legend('T(m)', 'Asymptotic Expression',1);  set(h_legend,'FontSize',10);  set(h_legend, 'Box', 'off')  print -depsc2 t1.eps  %  % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  % %%%% ANYTIME CAPACITY  if (1)    id = 1;  for m=mrange    a(id) = m.* t(id);  C(id)= t(id);  id = id +1;  end    figure(2)    plot( a, C , 'r' , 'LineWidth', 2 )  hold on    grid on  % %  aa = -log(P(1,1))/log(2):0.01:max(a);  %  Ca = R(1).*( aa ./( aa + log(P(1,1))/log(2) ) ) ;  plot( aa, Ca , 'b' , 'LineWidth', 2 )      axis([0 a(end)+1 0 3])  set(gca,...  'Units','normalized',...  'YTick',0:.5:3,...  'XTick',0:1:a(end)+1,...  'FontUnits','points',...  'FontWeight','normal',...  'FontSize',12,...  'FontName','Times')  ylabel({'C_A(\alpha)'},...  'FontUnits','points',...  'interpreter','tex',...  'FontSize',12,...  'FontName','Times')  xlabel('\alpha',...  'FontUnits','points',...  'interpreter','tex',...  'FontWeight','normal',...  'FontSize',12,...  'FontName','Times')    print -depsc2 c1.eps   %plot( mrange1.*( -1./mrange1 .* log( P(1,1) ./ 2.^( R(1) * mrange1))/log(2) ), -1./mrange1 .* log( P(1,1) ./ 2.^( R(1) * mrange1))/log(2) , 'b:' , 'LineWidth', 2 )    end  %   % %   % % figure(3)  % % [ax,h1,h2] =plotyy(mrange, t,mrange, mrange.*t,'plot','plot');  % %   % % set(ax,{'ycolor'},{'k';'r'})   % % set(h1,'linewidth',2)% to change the first line  % % set(h2,'linewidth',2)% to change the first line  % % set(h1,'color', 'k');% to change the first line   % % set(h2,'color','r')% to change the first line   % % %set(gca,'LineStyle', 'k');  % % % p1.LineWidth = 2;  % % % p2.LineStyle = 'r';  % % % p2.LineWidth = 2;  % %   % % ylabel(ax(1),{'T(m)'},...  % % 'FontUnits','points',...  % % 'interpreter','latex',...  % % 'FontSize',12,...  % % 'FontName','Times')  % %   % % ylabel(ax(2),{'mT(m)'},...  % % 'FontUnits','points',...  % % 'interpreter','latex',...  % % 'FontSize',12,...  % % 'FontName','Times')  % %   % % grid(ax(1),'on')  % % set(ax(1), 'YLim', [0 3.5])  % % set(ax(2), 'YLim', [0 4.5])  % %   % % xlabel('m',...  % % 'FontUnits','points',...  % % 'interpreter','latex',...  % % 'FontWeight','normal',...  % % 'FontSize',12,...  % % 'FontName','Times')  % %   % % hold(ax(1))  % % plot(ax(1),mrange1, -1./mrange1 .* log( P(1,1) ./ 2.^( R(1) * mrange1))/log(2) , 'k--' , 'LineWidth', 2 )  % % hold(ax(2))  % % plot(ax(2),mrange1, - log( P(1,1) ./ 2.^( R(1) * mrange1))/log(2) , 'r--' , 'LineWidth', 2 )  %   % %clear  % clc  %   % n=4;  %   % R = [1 3 4 5];  % P =1/16*[1 13 1 1;13 1 1 1;1 1 1 13; 1 1 13 1];  %   % mmax=20  % id = 1;  % mrange = 0.00001:.01:mmax;  %   % for m=mrange  %   % for i = 1:1:n  % for j = 1:1:n  % H(i,j) = 2^( -m*R(j) ) *P(j,i);  % H1(i,j) = 2^( -R(j) ) *P(j,i);  % end  % end  %   % t(id) = -1/m * log (max(eig(H)))/log(2);  % s(id) = max(eig(H))^(1/m);  %   % id=id+1;  %   % end  %   % figure(1)  % plot( mrange, t , 'r' , 'LineWidth', 2 )  % hold on  % mrange1 = 4:.001:mmax;  % plot( mrange1, -1./mrange1 .* log( P(1,1) ./ 2.^( R(1) * mrange1))/log(2) , 'k--' , 'LineWidth', 2 )  % grid on  %   % axis([0 mrange(end) 1 3.5])  % set(gca,...  % 'Units','normalized',...  % 'YTick',1:.5:3,...  % 'XTick',0:5:mrange(end),...  % 'FontUnits','points',...  % 'FontWeight','normal',...  % 'FontSize',12,...  % 'FontName','Times')  %   % ylabel({'T(m)'},...  % 'FontUnits','points',...  % 'interpreter','Latex',...  % 'FontSize',12,...  % 'FontName','Times')  % xlabel('m',...  % 'FontUnits','points',...  % 'interpreter','Latex',...  % 'FontWeight','normal',...  % 'FontSize',12,...  % 'FontName','Times')  %   % h_legend=legend('T(m)', 'Asymptotic Expression',1);  % set(h_legend,'FontSize',12);  % set(h_legend,'FontName','Times');  % set(h_legend, 'Box', 'off');  % set(h_legend, 'interpreter','latex');  %   % print -depsc2 t2.eps  %   % %  % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  % % %%%% ANYTIME CAPACITY  % if (1)  %   % id = 1;  % for m=mrange  %   % a(id) = m.* t(id);  % C(id)= t(id);  % id = id +1;  % end  %   % figure(2)  %   % plot( a, C , 'r' , 'LineWidth', 2 )  % hold on  %   % grid on  % % %  % aa = -log(P(1,1))/log(2)*2:0.01:max(a);  % %  % Ca = R(1).*( aa ./( aa + log(P(1,1))/log(2) ) ) ;  % plot( aa, Ca , 'k--' , 'LineWidth', 2 )  %   %   % axis([0 a(end) 1 3.5])  % set(gca,...  % 'Units','normalized',...  % 'YTick',0.5:.5:3,...  % 'XTick',0:5:a(end),...  % 'FontUnits','points',...  % 'FontWeight','normal',...  % 'FontSize',12,...  % 'FontName','Times')  %   % ylabel({'C_A(\alpha)'},...  % 'FontUnits','points',...  % 'interpreter','tex',...  % 'FontSize',12,...  % 'FontName','Times')  % xlabel('\alpha',...  % 'FontUnits','points',...  % 'interpreter','tex',...  % 'FontWeight','normal',...  % 'FontSize',12,...  % 'FontName','Times')  %   % h_legend=legend('$C_A(\alpha)$', 'Asymptotic Expression',1);  % set(h_legend,'FontSize',12);  % set(h_legend,'FontName','Times');  % set(h_legend, 'Box', 'off');  % set(h_legend, 'interpreter','latex');  %   % print -depsc2 c2.eps  %   %   % %plot( mrange1.*( -1./mrange1 .* log( P(1,1) ./ 2.^( R(1) * mrange1))/log(2) ), -1./mrange1 .* log( P(1,1) ./ 2.^( R(1) * mrange1))/log(2) , 'b:' , 'LineWidth', 2 )  %   % end  %   % %   % % figure(4)  % % [ax,h1,h2] =plotyy(mrange, t,mrange, mrange.*t,'plot','plot');  % %   % % set(ax,{'ycolor'},{'k';'r'})   % % set(h1,'linewidth',2)% to change the first line  % % set(h2,'linewidth',2)% to change the first line  % % set(h1,'color', 'k');% to change the first line   % % set(h2,'color','r')% to change the first line   % % %set(gca,'LineStyle', 'k');  % % % p1.LineWidth = 2;  % % % p2.LineStyle = 'r';  % % % p2.LineWidth = 2;  % %   % % ylabel(ax(1),{'T(m)'},...  % % 'FontUnits','points',...  % % 'interpreter','latex',...  % % 'FontSize',12,...  % % 'FontName','Times')  % %   % % ylabel(ax(2),{'mT(m)'},...  % % 'FontUnits','points',...  % % 'interpreter','latex',...  % % 'FontSize',12,...  % % 'FontName','Times')  % %   % % grid(ax(1),'on')  % %   % % set(ax(1), 'YLim', [0 3.5])  % % set(ax(2), 'YLim', [0 25.5])  % %   % % xlabel('m',...  % % 'FontUnits','points',...  % % 'interpreter','latex',...  % % 'FontWeight','normal',...  % % 'FontSize',12,...  % % 'FontName','Times')  % %   % % hold(ax(1))  % % plot(ax(1),mrange1, -1./mrange1 .* log( P(1,1) ./ 2.^( R(1) * mrange1))/log(2) , 'k--' , 'LineWidth', 2 )  % % hold(ax(2))  % % plot(ax(2),mrange1, - log( P(1,1) ./ 2.^( R(1) * mrange1))/log(2) , 'r--' , 'LineWidth', 2 )