爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 5470|回复: 0

[源程序] MK 趋势检验

[复制链接]

新浪微博达人勋

发表于 2019-11-9 21:36:09 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
本帖最后由 投入使用 于 2019-11-9 21:37 编辑

%Mann-kendall趋势检验
clc;
clear;
xx=xlsread('');   %读取列数据

x=xx';
[m,n]=size(x);
s=0;
for i=1:n-1,
for j=i+1:n,
s=s+sign(x(j)-x(i));
end
end
% variance ( assuming no tied groups )
v=(n*(n-1)*(2*n+5))/18;
% test statistic
if s == 0,
z = 0;
elseif s > 0,
z =(s -1)/sqrt(v);
else
z = (s+1)/sqrt(v);
end;
% should calculate Normal value here   显著性水平为5%
nor = 1.96;
% results
disp( [ ' n = ' num2str( n ) ] );
disp( [ ' Mean Value = ' num2str( mean( x ) ) ] );
disp( [ ' Z statistic = ' num2str( z ) ] );
if abs( z ) < nor,
disp( ' No' );
elseif z > 0,
disp( ' Upward ' );
else
disp( ' Downward' );
end;

MK.m

928 Bytes, 下载次数: 5, 下载积分: 金钱 -5

密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表