MATLAB
10. Other Commands
diff command
You should have discovered that the diff command has a different meaning in MATLAB compared to “Maple”. In MATLAB diff(vec) finds the differences between elements in the array vec. In “Maple”, if S is a symbolic expression, diff(S) finds its derivative.
However, you know that
Hence, if the differences are divided by a tiny step-size they should be crude approximations to the derivative.