Practically calculating the derivative of a digital signal is straightforward, just convolve the signal samples with the taps of a(n approximate) derivative filter. MatLab has the functions filter() and conv() which can help you do this.
The First Difference derivative filter has taps
$$h[n] = [1.0, -1.0]$$
The Central Difference derivative filter has taps
$$h[n] = [1.0, 0.0, -1.0]$$
These both are truncated versions of the Ideal derivative filter.
Note that the Ideal derivative filter multiplies a signal's spectrum by $j\omega \cdot e^{j\omega \mu}$ in the frequency domain. In the time domain, this ideal filter is an infinitely long filter with taps:
$$h[n] = \dfrac{1}{n+\mu}\left[\cos(\pi \left[n+\mu\right])-\mathrm{sinc}(n+\mu)\right]$$
Where
$n$ is the filter tap index in $(-\infty, \infty).$
$\mu$ corresponds to an inter-sample shift of the filter taps in the range $[0.0, 1.0]$ samples.
Given the above expression for $h[n]$ of the Ideal derivative filter, note that:
The Central difference is $h[n]$ truncated to 3 taps with $\mu = 0$.
The First difference is a scaled version of $h[n]$ truncated to 2 taps with $\mu = 0.5$.