Compute discretetime derivative
Simulink / Discrete
The Discrete Derivative block computes an optionally scaled discrete time derivative as follows
$$y({t}_{n})=K\left(\frac{u({t}_{n})u({t}_{n1})}{{T}_{s}}\right)$$
where
$$u({t}_{n})$$ and $$y({t}_{n})$$ are the block input and output at the current time step, respectively.
$$u({t}_{n1})$$ is the block input at the previous time step.
$$K$$ is an optional scaling factor, specified using the Gain value parameter.
$${T}_{s}$$ is the simulation's discrete step size, which must be fixed.
Note
Do not use this block in subsystems with a nonperiodic trigger (for example, nonperiodic functioncall subsystems). This configuration produces inaccurate results.
Data Types 

Direct Feedthrough 

Multidimensional Signals 

VariableSize Signals 

ZeroCrossing Detection 
