If you are trying to find the entries with numerical difference being zero, you might end up with nothing because the differences may be non-zero for all entries because they are `double`, and assuming these 616 entries are approximation to something. I suggest you might wanna try to set a tolerance `Tol`: for example X = sin(linspace(0,2*pi,616)'); % this gives you an X being the grid approximation to sine Y = diff(X); Tol = 1e-2*2*pi/616; indY = find(abs(Y) < Tol); % the index of the difference vector that has absolute value < Tolerance Then `X(indY)` and `X(indY+1)` will give you the entries of `X` that produces these less-than-tolerance differences. If the latter is bigger than the former, then `X` starts to increase (approximation), vice versa.