Home > wafo > wsim > mctpsim.m

# mctpsim

## PURPOSE

Simulates a Markov chain of turning points

## SYNOPSIS

[x,out2,out3] = mctpsim(varargin)

## DESCRIPTION

``` MCTPSIM  Simulates a Markov chain of turning points
The process x has the state space {1,2,...,n}.

CALL: [x] = mctpsim(F,T);
[x] = mctpsim(F,T,init);
[x] = mctpsim(F,T,init,'x');
[RFM,RFM0,res] = mctpsim(F,T,init,'RFM');
[x,RFM] = mctpsim(F,T,init,'x,RFM');

x       = Simulated switching Markov turning points.
RFM     = Rainflow matrix for x.                        [nxn]
RFM0    = Rainflow matrix for x (without the residual). [nxn]
res     = Residual from rainflow count.                 [nx2]

F       = Cell array of min-Max and Max-min matrices {1,2}
F{1,1}  = min-Max matrix, process 1                  [nxn]
F{1,2}  = Max-min matrix, process 1                  [nxn]
T       = Length of simulation.
init.x0 = Initial state of process x. If not given, it will start from
the stationary distribution of minima.

Simulates a Markov chain of turning points,
The process x has the state space {1,2,...,n}.

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

Examples:
FF = mktestmat([-1 1 32],[-0.2 0.2],0.15,1);
x = mctpsim({FF []},1000);```

## CROSS-REFERENCE INFORMATION

This function calls:
 smctpsim Simulates a switching Markov chain of turning points,
This function is called by:
 Chapter4 % CHAPTER4 contains the commands used in Chapter 4 of the tutorial itmkurs_lab2 Script to computer exercises 2 itmkurs_lab3 Script to computer exercises 3 test_cycles Quick test of the routines in module 'cycles' test_markov Quick test of the routines in module 'markov'

## SOURCE CODE

```001 function [x,out2,out3] = mctpsim(varargin)
002 %MCTPSIM  Simulates a Markov chain of turning points
003 %  The process x has the state space {1,2,...,n}.
004 %
005 % CALL: [x] = mctpsim(F,T);
006 %       [x] = mctpsim(F,T,init);
007 %       [x] = mctpsim(F,T,init,'x');
008 %       [RFM,RFM0,res] = mctpsim(F,T,init,'RFM');
009 %       [x,RFM] = mctpsim(F,T,init,'x,RFM');
010 %
011 % x       = Simulated switching Markov turning points.
012 % RFM     = Rainflow matrix for x.                        [nxn]
013 % RFM0    = Rainflow matrix for x (without the residual). [nxn]
014 % res     = Residual from rainflow count.                 [nx2]
015 %
016 % F       = Cell array of min-Max and Max-min matrices {1,2}
017 % F{1,1}  = min-Max matrix, process 1                  [nxn]
018 % F{1,2}  = Max-min matrix, process 1                  [nxn]
019 % T       = Length of simulation.
020 % init.x0 = Initial state of process x. If not given, it will start from
021 %           the stationary distribution of minima.
022 %
023 % Simulates a Markov chain of turning points,
024 % The process x has the state space {1,2,...,n}.
025 %
026 % If a matrix F{1,2}=[], then the process will
027 % be assumed to be time-reversible.
028 %
029 % Examples:
030 %   FF = mktestmat([-1 1 32],[-0.2 0.2],0.15,1);
031 %   x = mctpsim({FF []},1000);
032
033 init.z0=1;
034
035 [x,out2,out3] = smctpsim(1,varargin{:});
036 %switch whatOut
037
038 %case {'x'}
039
040 %  x = smctpsim(1,vargin{:});
041
042 %case {'RFM'}
043
044 %  [x,out2,out3] = smctpsim(1,vargin{:});
045
046 %case {'x','x,RFM'}
047
048 %  [x,out2] = smctpsim(1,vargin{:});
049
050 %end
051```

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