I'm facing a problem when program the numerical integration of $\int_t^{\infty}\frac{1}{(u+1)^2}du$, I know that the true value is $\frac{1}{1+t}$, however, when I want to calculate the definite integration numerically, I found the result is very strange like following:

The blue curve is the true value, the red curve is the numerical integration.
The problem setup is that I know $X_1,X_2,\cdots,X_n$ (ranges from $0$ to $1$), then I tried to program following code in matlab:
((1./(1+Xi_sort).^2).*(Xi_sort-[0;Xi_sort(1:n-1)]))'*tril(ones(n,n),0)
What's wrong with this? Thank you so much for your help.