Rain flow for MATLAB

Version date: 12.01.2005

Description

Here you can find the rain flow algorithm for cycle counting, adapted for work in the MATLAB® environment. It has been translated from Turbo Pascal into C language and compiled to the MEX function. The algorithm code has been prepared according to the ASTM standard [1] and optimized considering the calculation time. The function was tested with use of PC computers in the MS Windows® operating system.
Please send all your remarks, suggestions and questions to the author.
E-mail: Adam Niesłony

Author

The MEX function of the rain flow algorithm has been elaborated by Adam Niesłony. At present he is a postgraduate student of Technical University of Opole and he works on his Doctor's thesis in Department of Mechanics and Machine Design.
See the following pages:
Technical University of Opole
Katedra MiPKM

Files

Toolbox files:

rainflow.m   - short description of the rainflow function,
rainflow.c   - C MEX code of the rainflow function,
rainflow.dll - compiled "rainflow.c" file (MATLAB 6.5, Windows 2000 Prof.),
rfhist.m     - histograms of rainflow data,
rfmatrix.m   - rainflow matrix calculation and visualization,
rfdemo1.m    - demo for cycle counting, recomended for short signals,
rfdemo2.m    - demo for rainflow matrix and histograms, recomended for long signals,
sig2ext.m    - auxiliary function for rfdemo, it searches turning points from signals.

Installation

In order to instal the rainflow function, you must realise standard tasks, necessary during addition of new toolboxes to the MATLAB, i.e.

  1. Download the file rainflow.zip
  2. Create a new directory for files of the rainflow toolbox
  3. Unpack all files from the archive to that directory
  4. Add a path to that directory, using the command "Edit Path" of the MATLAB

Quick start

Using demos:

clear all
rfdemo1
rfdemo2

Rainflow counting on self generated (or loaded) signal:

clear all
lengths=10000;
s=10*randn(lengths,1)+rand(lengths,1);
% or load the signal from file --> s=my_signal;
tp=sig2ext(s);
rf=rainflow(tp);
rfm=rfmatrix(rf,20,20);
surf(rfm)

References

[1] ASTM E 1049-85 (Reapproved 1997), Standard practices for cycle counting in fatigue analysis, in: Annual Book of ASTM Standards, Vol. 03.01, Philadelphia 1999, pp. 710-718

end of page
© by Adam Niesłony