function thchap=thc(X)
    
n=length(X);
Y=zeros(1,n-1);
for i=1:(n-1)
    Y(i)=X(i+1)*X(i);
end
W=cumsum(Y);
W2=cumsum(X.*X);
W2=W2(1:(n-1));
thchap=W./W2;
endfunction;
