If we want to convert from velocity to acceleration (or displacement to velocity), what we want is time domain differentiation. In matlab, given a signal x, your first inclicination might be plot(t, diff(x)*Fs). You will immediately get an error here, because matlab's diff routine computes a vector of first order differences x(2)-(1), x(3)-x(2), x(4)-x(3), etc. and there are only n-1 output values for n inputs values. I remember being a little unsure what to do about this. Perhaps the most useful thing I learned from my class on computation fluid dynamics is that it is okay to treat the boundaries differently in numerical differentiation. So, for example, we can use first order forward differences for the main part of the vector, and first order backward difference at the end. In other words, v=[ diff(x), x(end)-x(end-1)]/Fs is perfectly okay.
Surprisingly, diff() is the only difference routine provided by matlab. I guess they assume that if you want something more accurate, you will write it yourself. Here is a second order centered difference (with first order differences at the boundaries).
function d = cdiff(x, dt)
if (nargin<2)
dt =1 ;
end
d(1) = (x(2) - x(1)) / dt;
d(length(x)) = ( x(end) - x(end-1) ) / dt;
ndx = 2:(length(x)-1);
d(ndx) = (x( ndx+1) - x(ndx-1)) / (2 * dt);
I rarely feel the need to go beyond a second order difference formula, but higher orders do exist. Consult any book on numerical methods.
Differentiation will amplify high frequency noise in your signal. Depending on what you are interested in, you may need to apply a low pass filter afterwards to remove this noise.
/' $I