Home > wafo > wsim > rfm2dtp.m

# rfm2dtp

## PURPOSE

Reconstructs a sequence of turning points from a rainflow matrix.

## SYNOPSIS

[dtp,res]=rfm2dtp(F,res,N)

## DESCRIPTION

``` RFM2DTP  Reconstructs a sequence of turning points from a rainflow matrix.

CALL:  tp=rfm2dtp(RFM,res)
tp=rfm2dtp(RFM)
tp=rfm2dtp(RFM,res,N)

Input:
RFM   = Rainflow matrix                        [n,n]
res   = Residual.                              [nres,1]
N     = Generate approximately N points

Output:
tp    = Turning points.                        [N,1]

Generates a sequence of turning points from a rainflow matrix and its
residual.  If the residual is given, the cycles in the residual should
not be included in the rainflow matrix.   The rainflow count of the
output will be exactly the input rainflow matrix.
If a residual is not given, then a stationary residual is generated.
With the third argument you can set the length of the output signal.

Example:
x=load('sea.dat');
param = [-2 2 64]; n=param(3);
dtp0 = dat2dtp(param,x(:,2));
[RFM,RFM0,res0] = dtp2rfm(dtp0,n);
dtp = rfm2dtp(RFM0,res0);
plot(1:length(dtp0),dtp0,'b',1:length(dtp),dtp,'r')

See also  dat2dtp, dtp2rfm```

## CROSS-REFERENCE INFORMATION

This function calls:
 rfc2load_fat Recontructs a load process given the frequency matrix (and residual). error Display message and abort function.
This function is called by:
 test_markov Quick test of the routines in module 'markov'

## SOURCE CODE

```001 function [dtp,res]=rfm2dtp(F,res,N)
002 %RFM2DTP  Reconstructs a sequence of turning points from a rainflow matrix.
003 %
004 % CALL:  tp=rfm2dtp(RFM,res)
005 %        tp=rfm2dtp(RFM)
006 %        tp=rfm2dtp(RFM,res,N)
007 %
008 % Input:
009 %   RFM   = Rainflow matrix                        [n,n]
010 %   res   = Residual.                              [nres,1]
011 %   N     = Generate approximately N points
012 %
013 % Output:
014 %   tp    = Turning points.                        [N,1]
015 %
016 % Generates a sequence of turning points from a rainflow matrix and its
017 % residual.  If the residual is given, the cycles in the residual should
018 % not be included in the rainflow matrix.   The rainflow count of the
019 % output will be exactly the input rainflow matrix.
020 % If a residual is not given, then a stationary residual is generated.
021 % With the third argument you can set the length of the output signal.
022 %
023 % Example:
024 %   x=load('sea.dat');
025 %   param = [-2 2 64]; n=param(3);
026 %   dtp0 = dat2dtp(param,x(:,2));
027 %   [RFM,RFM0,res0] = dtp2rfm(dtp0,n);
028 %   dtp = rfm2dtp(RFM0,res0);
029 %   plot(1:length(dtp0),dtp0,'b',1:length(dtp),dtp,'r')
030 %
031 % See also  dat2dtp, dtp2rfm
032
033 % Copyright (c) 2004 by Pär Johannesson
034
035 % Tested  on Matlab  6.5
036 %
037 % History:
038 % Created by PJ (Pär Johannesson) 16-Feb-2004
039
040 %%%%
041 % Check input arguments
042
043 ni = nargin;
044 no = nargout;
045 error(nargchk(1,3,ni));
046
047 if ni<2, res=[]; end
048 if ni<3, N=[]; end
049
050 f = fliplr(F)'; % Convert to FAT-def
051 n=length(F);
052 res = n-res+1;  % Convert to FAT-def
053
054 % Call function 'rfc2load' originally from FAT (Fatigue Analysis Toolbox)
055 % FAT is a predecessor of WAFO
056 [dtp,res] = rfc2load_fat(f,res,N);
057
058 dtp=n-dtp+1;    % Convert to WAFO-def
059 res=n-res+1;    % Convert to WAFO-def```

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