DAT2LC Extracts level-crossing spectrum from data, optionally rainflowfiltered. CALL: lc = dat2lc(x,h,def); x = two column data matrix with sampled times and values. h = a threshold; if h<=0, then a sequence of turning points is used (default); if h>0, then rainflow filtered cycles are used def = 1, only upcrossings. 2, upcrossings and maxima (default). 3, upcrossings, minima, and maxima. 4, upcrossings and minima. lc = two column matrix with levels and number of upcrossings, i.e., level-crossing spectrum. Example: x = load('sea.dat'); lc = dat2lc(x,0.2,1); lcplot(lc) plot(lc(:,1),lc(:,2)) See also dat2tp, mm2lc, dat2crossind
Extracts turning points from data, | |
Extracts level-crossing spectrum from min2Max cycles. | |
Display message and abort function. | |
Standard deviation. |
% CHAPTER2 Modelling random loads and stochastic waves | |
% CHAPTER4 contains the commands used in Chapter 4 of the tutorial | |
Simulates process with given irregularity factor and crossing spectrum | |
Quick test of the routines in module 'cycles' |
001 function lc = dat2lc(x,h,def); 002 %DAT2LC Extracts level-crossing spectrum from data, 003 % optionally rainflowfiltered. 004 % 005 % CALL: lc = dat2lc(x,h,def); 006 % 007 % x = two column data matrix with sampled times and values. 008 % h = a threshold; 009 % if h<=0, then a sequence of turning points is used (default); 010 % if h>0, then rainflow filtered cycles are used 011 % def = 1, only upcrossings. 012 % 2, upcrossings and maxima (default). 013 % 3, upcrossings, minima, and maxima. 014 % 4, upcrossings and minima. 015 % 016 % lc = two column matrix with levels and number of upcrossings, 017 % i.e., level-crossing spectrum. 018 % 019 % Example: 020 % x = load('sea.dat'); 021 % lc = dat2lc(x,0.2,1); 022 % lcplot(lc) 023 % plot(lc(:,1),lc(:,2)) 024 % 025 % See also dat2tp, mm2lc, dat2crossind 026 027 % 028 % Tested on: matlab 6.0, 5.3, 5.2, 5.1 029 % History: 030 % revised jr 02.04.2001 031 % - added example, updated info 032 % revised pab 30.12.2000 033 % - added internal plotflag 034 % revised pab 24.11.2000 035 % by Per A. Brodtkorb 11.08.99 036 % 037 038 error(nargchk(1,3,nargin)) 039 plotflag=0; 040 if nargin<2|isempty(h), h=0; end 041 if nargin<3|isempty(def), def=2; end 042 043 tp=dat2tp(x,max(h,0)); 044 [n m]= size(tp); 045 mM = [tp(1:2:n-1,m) tp(2:2:n,m)]; 046 047 if plotflag 048 lc = mm2lc(mM,def,1,std(x(:,2))); 049 else 050 lc = mm2lc(mM,def,0); 051 end 052 053 054
Comments or corrections to the WAFO group