Home > m2html > plot_SLEM.m

plot_SLEM

PURPOSE ^

% Read the matrices P0 and C

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

% Read the matrices P0 and C

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 
0002 %% Read the matrices P0 and C
0003 [P0,Txt,Raw]=xlsread('P_matrix'); % Original probability transition matrix
0004 [C,Txt,Raw]=xlsread('C'); % Optimal minimal energy perturbation matrix
0005 P = P0+C; 
0006 
0007 %% Compute SLEM of P_E
0008 [V,D] = eig(P);
0009 for k = 1:128
0010    d(k) = D(k,k); 
0011 end
0012 d_sorted = sort(abs(d), 'descend');
0013 SLEM_P = d_sorted(2);
0014 
0015 %% Compute SLEM(P(s)) in Eq. (17)
0016 SLEM_Ps = []; 
0017 k =1;
0018 for s = 0:10^(-3):1
0019    SLEM_Ps(k) = (1-s) * SLEM_P; 
0020     k = k+1;
0021 end
0022 
0023 %% Compute SLEM of P0
0024 [V,D] = eig(P0);
0025 for k = 1:128
0026    d(k) = D(k,k); 
0027 end
0028 d_sorted = sort(abs(d), 'descend');
0029 SLEM_P0 = d_sorted(2);
0030 
0031 %% Compute SLEM(Q(s)) in Eq. (22)
0032 SLEM_Qs = []; 
0033 k =1;
0034 for s = 0:10^(-3):1
0035    SLEM_Qs(k) = (1-s) * SLEM_P0; 
0036     k = k+1;
0037 end
0038 
0039 %% Plot
0040 figure; plot([0:10^(-3):1], SLEM_Ps);
0041 hold on; plot([0:10^(-3):1], SLEM_Qs, '-- r'); 
0042 xlabel('s'); legend('SLEM (P(s))','SLEM (Q(s))')
0043 
0044 
0045 
0046 
0047 
0048 
0049 
0050

Generated on Thu 27-May-2010 16:35:43 by m2html © 2005