I need to know how to calculate first derivative of a signal (displacement in milimeters vs time in milliseconds) to know the highest positive and negative peak.
If you have an analytical function and you want to differentiate it, you could use symbolic processing:
syms x...... and other symbols
diff (f,x);
where f is your function, and you wish to differentiate it with respect to x
I suspect however from your question you just have a plot or a trace of the data ... so you could compute the derivative numerically using finite differences (and the fundamental definition of derivative is the limit of this expression as d -> 0):
f' ~= [f(x+d) - f(x)] / d
which simply requires the value of f at x and some small increment x+d ...
Be careful if you are trying to find max and min --- the first order test (f'=0) is necessary but not sufficient .... you have to be careful to check f" also (second derivative is negative at a max, and positive at a min)