DEMOCC_RFCDEF illustrates the definition of rainflow cycles. CALL: ccrfc=democc_rfcdef(proc,tp,point,ccrfc) Used by democc
plots load and marks a maximum | |
Hold current graph. | |
Infinity. | |
Wait for user response. | |
Linear plot. | |
Graph title. |
001 function ccrfc=democc_rfcdef(proc,tp,point,ccrfc) 002 %DEMOCC_RFCDEF illustrates the definition of rainflow cycles. 003 % 004 % CALL: ccrfc=democc_rfcdef(proc,tp,point,ccrfc) 005 % 006 % Used by democc 007 008 % Tested on: matlab 5.3 009 % History: 010 % Revised by PJ 10-Jan-2000 011 % updated for WAFO 012 % Original version by Mats Frendahl 013 014 ms = 20; % markersize 015 016 democc_markmax(proc,tp,point,0); 017 018 proc=[(1:length(proc))' proc(:,2)]; 019 time=proc(:,1); L=proc(:,2); n=length(L); 020 021 level=tp(point,2); refpoint=tp(point,1); 022 hold on, title('Definition of rainflow count') 023 crossleft=max(find(L(1:tp(point,1))>tp(point,2))); 024 if isempty(crossleft), 025 crossleft=1; 026 noleft=1; 027 else 028 noleft=0; 029 end 030 leftdepth=min(L(crossleft:refpoint)); 031 c1=[crossleft refpoint]; c2=[level level]; 032 plot(c1,c2,'--'), 033 034 pause(1) 035 036 leftindex=find(L(crossleft:refpoint)==leftdepth)+crossleft-1; 037 plot(leftindex,leftdepth,'k.','markersize',ms) 038 plot([leftindex leftindex],[leftdepth level],'--'); 039 040 pause(1) 041 042 list=find(L>=level); 043 if ( (length(list)>1) & ( refpoint<max(list))) 044 index=find(list==refpoint); 045 crossright=list(index+1); 046 noright=0; 047 else 048 crossright=n; 049 noright=1; 050 end 051 052 plot([tp(point,1) crossright],[level level],'--'), 053 054 pause(1) 055 056 if noright == 1 057 rightdepth = -Inf; 058 else 059 rightdepth=min(L(refpoint:crossright)); 060 rightindex=find(L(refpoint:crossright)==rightdepth)+refpoint-1; 061 plot(rightindex,rightdepth,'k.','markersize',ms) 062 plot([rightindex rightindex],[rightdepth level],'--'); 063 end 064 065 pause(1) 066 067 if leftdepth>rightdepth 068 plot([leftindex leftindex],[leftdepth level]); 069 rfcmin=leftdepth; 070 if noright~=1, 071 plot(rightindex,rightdepth,'k.','erase','xor','markersize',ms) 072 end 073 else 074 plot([rightindex rightindex],[rightdepth level]); 075 rfcmin=rightdepth; 076 % if noleft~=1 077 plot(leftindex,leftdepth,'k.','erase','xor','markersize',ms) 078 % end 079 end 080 081 hold off 082 083 if isempty(ccrfc) 084 ccrfc=[rfcmin level]; 085 else 086 ccrfc=[ccrfc; rfcmin level]; 087 end 088 089
Comments or corrections to the WAFO group