You can simply subtract the first element of the array from the second element to compute the distance between them in MATLAB.
Here's an example:
main.m88 chars3 lines
In the example above, f(2)
gives the value at index 2 of the array, which is -4
. Similarly, f(1)
gives the value at index 1 of the array, which is 2
. Finally, subtracting the two gives the distance between them, which is epsilon1 = -4 - 2 = -6
.
gistlibby LogSnag