Let's say I have an array. The difference between numbers is 1.
If I use a function 'diff' with 'unique', then I know whether the array is increasing or decreasing the constant amount.
ls = [1:10]'
In the above code, the answer is 1 obviously.
However, if I multiply 0.1 to the array, suddenly it does not work anymore.
I expected 'numel(unique(diff(ls * 0.1)))' gives '1' and the value is 0.1
However, Matlab says there are four different steps.
I guess this is due to small precision. If I divide the array with a prime number then I understand the results. However, in this case, it is a very simple calculation, dividing by 10.
Why it happens? or how can I solve this problem?