Home > online-code > main.m

main

PURPOSE ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The  program "main.m" reads a square matrix, 
% the probability transition matrix of the network, 
% "P_matrix.xls" in excel format and returns as output 
% the optimal perturbation matrix "C", which forces 
% the network to transition from its initial steady-state to the desired steady-state pid. 
% This code uses the CVX software. For installation instructions, please 
% refer to: http://cvxr.com/cvx/download

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0002 %% The  program "main.m" reads a square matrix,
0003 %% the probability transition matrix of the network,
0004 %% "P_matrix.xls" in excel format and returns as output
0005 %% the optimal perturbation matrix "C", which forces
0006 %% the network to transition from its initial steady-state to the desired steady-state pid.
0007 %% This code uses the CVX software. For installation instructions, please
0008 %% refer to: http://cvxr.com/cvx/download
0009 
0010 %% Define the variables
0011 %%%%%%%%%%%%%%%%%%%%%%%%
0012 
0013 [P0,Txt,Raw]=xlsread('P_matrix');
0014 N = size(P0,1);
0015 OneVec = ones(N,1);
0016 
0017 
0018 %% Define the desired steady-state distribution
0019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0020 
0021 pid1 = 0.015525 * ones(64,1);
0022 pid2 = 10^(-4) * ones(64,1);
0023 pid = [pid1;pid2];
0024 
0025 
0026 %% Call the optimal_control function
0027 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0028 
0029 C = optimal_control(P0,pid);
0030 
0031 
0032 %% Writing and plotting
0033 %%%%%%%%%%%%%%%%%%%%%%%%
0034  
0035 success = xlswrite('Perturbation-Matrix', C);
0036