Home > wafo > cycles > dtp2arfm.m

dtp2arfm

PURPOSE ^

Calculates asymmetric RFM from discrete turning points.

SYNOPSIS ^

[RFM,RFM1,res] = dtp2arfm(x,in2,in3,res0)

DESCRIPTION ^

 DTP2ARFM Calculates asymmetric RFM from discrete turning points.
 
  CALL:            RFM = dtp2arfm(x,n)
        [RFM,RFM1,res] = dtp2arfm(x,n,def)
        [RFM,RFM1,res] = dtp2arfm(x,def,RFM0,res0)
 
  Output:
    RFM   = Asymmetric rainflow matrix (residual included).      [n,n]
    RFM1  = Asymmetric rainflow matrix (without resudual).       [n,n]
    res   = Residual.                                [nres,1]/[nres,2]
 
  Input:
    x     = Turning points (taking values 1,...,n). [T,1]/[T,2]
    n     = Number of levels.
    def   = Treatment of residual.
            'up':   Count min-to-Max cycles,    (default)
                    gives correct number of upcrossings.
            'down': Count Max-to-min cycles, 
                    gives correct number of downcrossings.
            'CS':   Cloormann/Seeger method, 
                    gives all closed hysterisis loops.
                    This method is identical to the French AFNOR recommendation,
                    and the ASTM standard (variant called simplified version).
    RFM0  = Asymmetric rainflow matrix (without resudual).     [n,n]
    res0  = Residual (taking values 1,...,n).       [nres0,1]/[nres0,2]
 
  Calculates the Asymmetric RainFlow Matrix (ARFM) for the sequence of 
  discrete turning points,  by using the so-called 4-point algorithm.
 
  It is possible to calculate ARFM for 'dtp' and continue the counting 
  from previously counted 'ARFM0' with residual 'res0'
    [ARFM,ARFM1,res] = dtp2arfm(dtp,def,ARFM0,res0)
 
  Example:
    x = load('sea.dat');                   % Load data
    [dtp,u,tp] = dat2dtp([-2 2 32],x,0.2); % Discrete TP & rainflow filter 0.2
    ARFM = dtp2arfm(dtp,32);            % Calculate asymmetric rainflow matrix
    cmatplot(u,u,ARFM,3), colorbar      % Plot rainflow matrix
  
  See also  dtp2arfm4p, dtp2rfm, dcc2cmat, tp2rfc, dat2tp

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function [RFM,RFM1,res] = dtp2arfm(x,in2,in3,res0)
002 %DTP2ARFM Calculates asymmetric RFM from discrete turning points.
003 %
004 % CALL:            RFM = dtp2arfm(x,n)
005 %       [RFM,RFM1,res] = dtp2arfm(x,n,def)
006 %       [RFM,RFM1,res] = dtp2arfm(x,def,RFM0,res0)
007 %
008 % Output:
009 %   RFM   = Asymmetric rainflow matrix (residual included).      [n,n]
010 %   RFM1  = Asymmetric rainflow matrix (without resudual).       [n,n]
011 %   res   = Residual.                                [nres,1]/[nres,2]
012 %
013 % Input:
014 %   x     = Turning points (taking values 1,...,n). [T,1]/[T,2]
015 %   n     = Number of levels.
016 %   def   = Treatment of residual.
017 %           'up':   Count min-to-Max cycles,    (default)
018 %                   gives correct number of upcrossings.
019 %           'down': Count Max-to-min cycles, 
020 %                   gives correct number of downcrossings.
021 %           'CS':   Cloormann/Seeger method, 
022 %                   gives all closed hysterisis loops.
023 %                   This method is identical to the French AFNOR recommendation,
024 %                   and the ASTM standard (variant called simplified version).
025 %   RFM0  = Asymmetric rainflow matrix (without resudual).     [n,n]
026 %   res0  = Residual (taking values 1,...,n).       [nres0,1]/[nres0,2]
027 %
028 % Calculates the Asymmetric RainFlow Matrix (ARFM) for the sequence of 
029 % discrete turning points,  by using the so-called 4-point algorithm.
030 %
031 % It is possible to calculate ARFM for 'dtp' and continue the counting 
032 % from previously counted 'ARFM0' with residual 'res0'
033 %   [ARFM,ARFM1,res] = dtp2arfm(dtp,def,ARFM0,res0)
034 %
035 % Example:
036 %   x = load('sea.dat');                   % Load data
037 %   [dtp,u,tp] = dat2dtp([-2 2 32],x,0.2); % Discrete TP & rainflow filter 0.2
038 %   ARFM = dtp2arfm(dtp,32);            % Calculate asymmetric rainflow matrix
039 %   cmatplot(u,u,ARFM,3), colorbar      % Plot rainflow matrix
040 % 
041 % See also  dtp2arfm4p, dtp2rfm, dcc2cmat, tp2rfc, dat2tp
042 
043 % Tested on Matlab 5.3
044 %
045 % History:
046 % Revised by PJ 26-Jul-2000
047 %   New input 'def'. 
048 %   Now supports ANFOR and ASTM standards for rainflow counting.
049 % Revised by PJ (Pär Johannesson) 12-Jan-2000
050 %   updated for WAFO
051 % Created by PJ (Pär Johannesson) 1999
052 
053 % Check input arguments
054 
055 ni = nargin;
056 no = nargout;
057 error(nargchk(2,4,ni));
058 
059 if ni == 2
060   n = in2; % Number of levels
061   def = [];
062   RFM = zeros(n);
063   res0 = [];
064 elseif ni == 3
065   n = in2; % Number of levels
066   def = in3;
067   RFM = zeros(n);
068   res0 = [];
069 else
070   def = in2;
071   RFM0 = in3;
072   n = length(RFM0);
073   RFM = zeros(n);
074 end
075 
076 % Default value
077 if isempty(def), def_res='up'; end
078 
079 % Calculate RFM and res
080 [RFM,res] = dtp2arfm4p(x,n,res0);
081 
082 % Add previously counted cycles (if any)
083 if ni == 4
084   RFM = RFM+RFM0;
085 end
086 
087 % Two or more outputs ?
088 if no >= 2
089   RFM1 = RFM;
090 end
091 
092 % Treat residual
093 % Calculate RFM = RFM0 + 'cycles in res'
094 ARFC_res = res2arfc(res(:,end),def);
095 for i=1:size(ARFC_res,1)
096   RFM(ARFC_res(i,1),ARFC_res(i,2)) = RFM(ARFC_res(i,1),ARFC_res(i,2)) + 1;
097 end
098 
099

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