資源簡介
matlab編碼實現的完整m-k突變分析,支持出圖。圖像可在matlab中自行編輯。
代碼片段和文件信息
%??????The?script?was?written?by?Dr.?Qiang?Zhang?from?
%??????Nanjing?Institute?of?Geography?and?Limnology?
%??????Chinese?Academy?of?Sciences?on?March?26?2006.?
%??????Financially?supported?by?Alexander?von?Humboldt?Stiftung?Germany?
%?if?you?use?this?script?for?research?please?cite?the?references?below:?
%%??Reference:??
%???Gerstengarbe?F.W.?and?Werner?P.C.?1999.?Estimation?of?the?beginning?and?end?of?
%%??recurrent?events?within?a?climate?regime.?Climate?Research?11:?97-107.?
% Qiang?Zhang?Chunling?Liu?Chong-yu?Xu?Youpeng?Xu?Tong?Jiang.?Observed?trends?of?annual?maximum??
%???water?level?and?streamflow?during?past?130?years?in?the?Yangtze?River?basin?China.?Journal?of?Hydrology?2006?324?255-265.?
function?[z]=mk(x)?
%?x為一時間序列(列向量)?
%?define?the?time?
time=2000+(0:length(x)-1);??%?please?alter?the?starting?year?of?this?series.?
n=length(x);?%the?size?of?the?series?
[rowscols]=size(x);?
%---------JUDGEMENT?OF?TIME?SERIES------------?
if?rows==1?
????error(‘x?should?be?a?column?vector‘)?
end?
if?cols~=1?
????error(‘x?should?be?a?column?vector‘)?
end?
%?-----------------COMPUTATION?in?normal?sequence--------------------?
for?k=2:n?
????count1=0;?
????for?j=1:k-1?
??????if?x(k)>x(j)?
????????count1=count1+1;?
??????end?
??????%junzhi=k*(k-1)/4;?
?????%?fangcha=k*(k-1)*(2*k+5)/72;?
??????%z(11)=0;?
?????%?z(k1)=(count1-junzhi)/sqrt(fangcha);?
????end?
??????junzhi1(k1)=k*(k-1)/4;?
??????fangcha1(k1)=k*(k-1)*(2*k+5)/72;?
??????zonghe1(11)=0;?
??????zonghe1(k1)=count1;?
end?
?
?
%-------------------COMPUTATION?IN?ADVERSE?SEQUENCY-----------------?
x1=flipud(x);?
?
for?m=2:n?
????count2=0;?
????for?i=1:m-1?
??????%bijiao=x1(m)-x1(i);?
??????if?x1(m)>x1(i)?
????????count2=count2+1;?
??????end?
??????%junzhi=m*(m-1)/4;?
??????%fangcha=m*(m-1)*(2*m+5)/72;?
??????%z(12)=0;?
??????%z(m2)=(count-junzhi)/sqrt(fangcha);?
????end?
??????junzhi2(m1)=m*(m-1)/4;?
??????fangcha2(m1)=m*(m-1)*(2*m+5)/72
評論
共有 條評論