资源描述:
《雨流计数法matlab程度源代码.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、%RAINFLOWcyclecounting.%RAINFLOWcountingfunctionallowsyoutoextract%cyclefromrandomloading.%%SYNTAX%rf=RAINFLOW(ext)%rf=RAINFLOW(ext,dt)%rf=RAINFLOW(ext,extt)%%OUTPUT%rf-rainflowcycles:matrix3xnor5xndependendoninput,%rf(1,:)Cyclesamplitude,%rf(2,:)Cyclesmeanvalue,%rf(3,:)Numberofcycles(0.5o
2、r1.0),%rf(4,:)Beginingtime(wheninputincludesdtorexttdata),%rf(5,:)Cycleperiod(wheninputincludesdtorexttdata),%%INPUT%ext-signalpoints,vectornx1,ONLYTURNINGPOINTS!,%dt-samplingtime,positivenumber,whentheturningpoints%spacedequally,%extt-signaltime,vectornx1,exacttimeofoccurrenceofturningpoi
3、nts.%%%SeealsoSIG2EXT,RFHIST,RFMATRIX,RFPDF3D.%RAINFLOW%Copyright(c)1999-2002byAdamNieslony,%MEXfunction.functionrfdemo1(ext)%functionrfdemo1(ext)%%RFDEMO1showscyclesextractedfromsignal%usingrainflowalgoritm.%%INPUT:ext-option,numberorvectorswithturning%pointsortimehistory.Defaultext=16.%%
4、OUTPUT:noenable.%%SYNTAX:%>>rfdemo1%>>rfdemo1(10)%>>rfdemo1([23242516])%%ByAdamNies硂ny%Revised,10-Nov-2009%VisittheMATLABCentralFileExchangeforlatestversion.error(nargchk(0,2,nargin))ifnargin==0,%turningpointsfrom16randomnumbersext=sig2ext(randn(4));elseiflength(ext(:))==1,%turningpointsfr
5、omnrandomnumbersext=sig2ext(randn(1,ext));else%turningpointsfromvectorextext=sig2ext(ext);enda=rainflow(ext,1);[mn]=size(a);%ifn>100,%button=questdlg(['Rainflowfound'num2str(sum(a(3,:)))'cycles!Doyouwanttocontinue?'],...%'ContinueOperation','Yes','No','No');%ifstrcmp(button,'No')%error('Fu
6、nctionabortedbyuser.')%end%endcol='ymcrgb';plot(0:length(ext)-1,ext,'k.:')holdonwyk=0:0.05:1;forc=1:n,colnr=rem(c-1,6)+1;nr1=round(a(4,c)+1);nr2=round(a(4,c)+1+a(5,c)*a(3,c));ifa(3,c)==1.0,ifext(nr1)7、a(2,c)-a(1,c),[int2str(c)'.Cycle,up'],...'Color',col(colnr),'VerticalAlignment','top')elseplot(wyk.*a(5,c)+a(4,c),cos(wyk.*2*pi)*a(1,c)+a(2,c),col(colnr))text(a(4,c),a(2,c)+a(1,c),[int2str(c)'.Cycle,down'],...'Color',col(colnr),'VerticalAlignment','bottom')end