Home > wafo > trgauss > iter.m

# iter

## PURPOSE

Calculates a Markov matrix given a rainflow matrix

## SYNOPSIS

[F, rfc]=iter(f0,f,k,epsilon)

## DESCRIPTION

```  ITER  Calculates a Markov matrix given a rainflow matrix

CALL: [fmM_k frfc_k]=iter(frfc,fmM_0,k,eps)

fmM_k  = the solution to the equation frfc = fmM + F(fmM),
frfc_k = the rainflow matrix; frfc_k = fmM_k + F(fmM_k).

frfc   = the rainflow matrix to be inverted,
fmM_0  = the first approximation to the Markov matrix, if not
specified  fmM_0=frfc,
k      = number of iterations, if not specified, k=1.
eps    = a convergence treshold, default value; eps=0.00001

## CROSS-REFERENCE INFORMATION

This function calls:
 mctp2rfc Rainflow matrix given a Markov matrix of a Markov chain of turning points num2str Convert number to string. (Fast version)
This function is called by:
 itmkurs_lab3 Script to computer exercises 3

## SOURCE CODE

```001 function [F, rfc]=iter(f0,f,k,epsilon)
002 % ITER  Calculates a Markov matrix given a rainflow matrix
003 %
004 %  CALL: [fmM_k frfc_k]=iter(frfc,fmM_0,k,eps)
005 %
006 %   fmM_k  = the solution to the equation frfc = fmM + F(fmM),
007 %   frfc_k = the rainflow matrix; frfc_k = fmM_k + F(fmM_k).
008 %
009 %
010 %   frfc   = the rainflow matrix to be inverted,
011 %   fmM_0  = the first approximation to the Markov matrix, if not
012 %            specified  fmM_0=frfc,
013 %   k      = number of iterations, if not specified, k=1.
014 %   eps    = a convergence treshold, default value; eps=0.00001
015 %
017
018 % References:
019 % Rychlik, I. (1996)
020 % 'Simulation of load sequences from Rainflow matrices: Markov method'
021 % Int. J. Fatigue, Vol 18, pp 429-438
022 %
023
024 % tested on matlab 5.2
025 % History:
026 % by ir 1995
027
028
029
030 if nargin < 2
031    f=f0;
032 end
033 if nargin <3
034    k=1;
035 end
036 if nargin <4
037    epsilon=0.00001;
038 end
039 check0=1;
040
041 f0=fliplr(f0);
042 f=fliplr(f);
043 for i=1:k
044   if check0
045    f1=f;
046    rfc=mctp2rfc(f);
047    f=f1+(f0-rfc);
048    f=max(0,f);
049    check=[k-i+1,  sum(sum(abs(f1-f))), sum(sum(f0))/sum(sum(f))];
050    disp(['iteration step, accuracy  ', num2str(check(1:2))])
051    check0=sum(sum(abs(f1-f)))>epsilon;
052  end
053 end
054
055 F=fliplr(f);
056 rfc=fliplr(mctp2rfc(f));
057
058
059```

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