登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
P=xlsread('C:\Users\Mysticism\Desktop\121.xlsx'); X=P(:,1); N=length(X); UF=zeros(N-1,1); for t=2:N x=X(1:t); S=0; n=length(x); fork=1:(n-1) forj=(k+1):n ifx(j)>x(k) S=S+1; else S=S+0; end end end ES=n*(n+1)/4; VarS=n*(n-1)*(2*n+5)/72; Z=(S-ES)/sqrt(VarS); UF(t-1)=Z; end Y=flipud(X); UB=zeros(N-1,1); for t=2:N x=Y(1:t); S=0; n=length(x); fork=1:(n-1) forj=(k+1):n ifx(j)>x(k) S=S+1; else S=S+0; end end end ES=n*(n+1)/4; VarS=n*(n-1)*(2*n+5)/72; Z=(S-ES)/sqrt(VarS); UB(t-1)=-Z; end T=2001:1:2017; plot(T,UF','r-','linewidth',1.5); hold on plot(T,UB','b-.','linewidth',1.5); axis([2001,2017,-5,5]); legend('UF统计量','UB统计量','0.05显著水平'); xlabel('年份','FontName','TimesNewRoman','FontSize',12); ylabel('统计量','FontName','TimesNewRoman','Fontsize',12); %grid on hold on plot(T,0*ones(1,N-1),'-.','linewidth',1.5); plot(T,1.96*ones(1,N-1),':','linewidth',1.5); plot(T,-1.96*ones(1,N-1),':','linewidth',1.5);
|