Home > wafo > markov > smctp2joint.m

# smctp2joint

## PURPOSE

Calculates the joint MCTP for a SMCTP.

## SYNOPSIS

[Q,QQ] = smctp2joint(P,F)

## DESCRIPTION

``` SMCTP2JOINT  Calculates the joint MCTP for a SMCTP.

CALL: [Q,QQ] = smctp2joint(P,F)

Q      = Cell array of min-max and max-min transition
matrices for joint MCTP.                   {1x2}
QQ     = Cell array of min-max and max-min transition
matrices matrices for SMCTP.               {rx2}

P      = Transition matrix for regime process.      [rxr]
F      = Cell array of min-Max and Max-min matrices {rx2}
F{i,1} = min-Max matrix, process i                  [nxn]
F{i,2} = Max-min matrix, process i                  [nxn]

If a matrix F{i,2}=[], then the process will
be assumed to be time-reversible.

## CROSS-REFERENCE INFORMATION

This function calls:
 mat2tmat Converts a matrix to a transition matrix. cell Create cell array. error Display message and abort function. kron Kronecker tensor product.
This function is called by:
 smctp2stat Stationary distributions for a switching MCTP. smctpsim Simulates a switching Markov chain of turning points,

## SOURCE CODE

```001 function [Q,QQ] = smctp2joint(P,F)
002 %SMCTP2JOINT  Calculates the joint MCTP for a SMCTP.
003 %
004 % CALL: [Q,QQ] = smctp2joint(P,F)
005 %
006 % Q      = Cell array of min-max and max-min transition
007 %          matrices for joint MCTP.                   {1x2}
008 % QQ     = Cell array of min-max and max-min transition
009 %          matrices matrices for SMCTP.               {rx2}
010 %
011 % P      = Transition matrix for regime process.      [rxr]
012 % F      = Cell array of min-Max and Max-min matrices {rx2}
013 % F{i,1} = min-Max matrix, process i                  [nxn]
014 % F{i,2} = Max-min matrix, process i                  [nxn]
015 %
016 % If a matrix F{i,2}=[], then the process will
017 % be assumed to be time-reversible.
018 %
020
021 % Tested  on Matlab  5.3
022 %
023 % History:
024 % Updated by PJ 18-May-2000
025 %   updated for WAFO
026 % Created by PJ (Pär Johannesson) 1999
027
028 % Check input arguments
029
030 ni = nargin;
031 no = nargout;
032 error(nargchk(2,2,ni));
033
034 % Define
035
036 r = length(P);   % Number of regime states
037 n = length(F{1,1});  % Number of levels
038
039 % Check that the rowsums of P are equal to 1
040
041 P = mat2tmat(P);
042
043 % Normalize the rowsums of F{1,1},...,F{r,1} to 1
044 %  ==>  QQ{1,1},...,QQ{r,1}
045
046 for i = 1:r
047   QQ{i,1} = F{i,1};
048   QQ{i,1} = mat2tmat(QQ{i,1},1);
049 end
050
051 % Normalize the rowsums of F{1,2},...,F{r,2} to 1
052 %  ==>  QQ{1,2},...,QQ{r,2}
053
054 for i = 1:r
055
056   if isempty(F{i,2})        % Time-reversible
057     QQ{i,2} = F{i,1}';
058   else                   % F{i,2} is given
059     QQ{i,2} = F{i,2};
060   end
061
062   QQ{i,2} = mat2tmat(QQ{i,2},-1);
063
064 end
065
066 Q = cell(1,2);
067
068 % Make the transition matrix Q for the joint min-Max process
069
070 Q{1,1} = zeros(n*r,n*r);
071 I = 0:r:(n-1)*r;
072 for z=1:r
073   Q0 = kron(QQ{z,1},P);
074   Q{1,1}(I+z,:) = Q0(I+z,:);
075 end
076
077
078 % Make the transition matrix Qh for the joint Max-min process
079
080 Q{1,2} = zeros(n*r,n*r);
081 I = 0:r:(n-1)*r;
082 for z=1:r
083   Q0 = kron(QQ{z,2},P);
084   Q{1,2}(I+z,:) = Q0(I+z,:);
085 end
086```

Mathematical Statistics
Centre for Mathematical Sciences
Lund University with Lund Institute of Technology

Comments or corrections to the WAFO group

Generated on Thu 06-Oct-2005 02:21:16 for WAFO by m2html © 2003