MATLAB Answers

How to plot the sen's slope to time series data using Mann-Kendall Test and Sen’s slope estimator

36 views (last 30 days)
Nommy
Nommy on 13 Apr 2019
Commented: Yan Tong on 12 Jul 2021
I want to plot a the sen's slope (linear line) on my time series data, I have already used mann kendall test fuction to see if the trend exist within the data, yes there is trend , but then the next stepis to estimate the sen's slope but I dont understand how this function below really works, please can someone clarify, what is my x and y?
function b = Theil_Sen_Regress(x,y)
[N c]=size(x);
Comb = combnk(1:N,2);
deltay=diff(y(Comb),1,2);
deltax=diff(x(Comb),1,2);
theil=diff(y(Comb),1,2)./diff(x(Comb),1,2);
b=median(theil);

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!