I want to determine the max difference between adjacent entries of a vector.
vector = [0 0 0 0.2 0.4 0.6 0.7 0.85 1 1 1];
difference = diff(vector);
i=find(diff(vector) == max(diff(vector)))
For the exemplary vector I would expect the following output:
However, I get:
The third one is missing. Checking this value, indeed I see some numerical error which should not be there.
Do I really have to use an almost equal function in order to solve this issue?