FINDRFC Finds indices to rainflow cycles of a sequence of TP. CALL: RFC_ind = findrfc(TP,h); TP = vector of turningpoints (NB! Only values, not sampled times) RFC_ind = indices to the rainflow cycles of the original sequence TP. h = a threshold, must be larger than zero. if h>0, then all rainflow cycles with height smaller than h are removed. This function is not implemented as a matlab function; instead, a mex file (originally written in C) is utilized. Example: x = load('sea.dat'); tp = dat2tp(x); ind = findrfc(tp(:,2),0.3); waveplot(x,tp(ind,:),1,1) See also tp2rfc, dat2tp.
Display message and abort function. |
Extracts turning points from data, |
001 function ind=findrfc(tp,h) 002 %FINDRFC Finds indices to rainflow cycles of a sequence of TP. 003 % 004 % CALL: RFC_ind = findrfc(TP,h); 005 % 006 % TP = vector of turningpoints (NB! Only values, not sampled times) 007 % 008 % RFC_ind = indices to the rainflow cycles of the 009 % original sequence TP. 010 % 011 % h = a threshold, must be larger than zero. 012 % if h>0, then all rainflow cycles with height 013 % smaller than h are removed. 014 % 015 % This function is not implemented as a matlab function; instead, a 016 % mex file (originally written in C) is utilized. 017 % 018 % Example: 019 % x = load('sea.dat'); 020 % tp = dat2tp(x); 021 % ind = findrfc(tp(:,2),0.3); 022 % waveplot(x,tp(ind,:),1,1) 023 % 024 % See also tp2rfc, dat2tp. 025 026 % This is a modified version of rfcfilt (found in WAT), which is about 20 027 % to 30 times faster than rfcfilt (on a PentiumII 233 MHz 028 % with 32 MB ram and Matlab 5.0 under Linux). The reason is 029 % that this version does not save TP to disk. Instead it passes 030 % the arguments directly to the executeable file. 031 % However, this solution requires different input and returns 032 % indices to the rfc instead of the rfc itself. 033 % It also ignores the first turningpoint if that is a maximum and 034 % starts on the first minimum when finding the sequence of rfc. 035 036 % Tested on Matlab 6.1,6.0, 5.2 037 % History: 038 % revised pab 10.08.2003 039 % - fixed a bug in the example 040 % Revised by pab 24.07.1999 041 042 043 ind=[]; 044 disp('FINDRFC is not implemented as a m-function') 045 disp(' compile the mexfile findrfc.c before you try again.') 046 error('findrfc error') 047 return
Comments or corrections to the WAFO group