Using the signal analysis blocks ExactDerivative, ApproximateDerivativeWithFilter, and ApproximateDerivativeWithWindow to compute the derivative of the input signal analytically or approximately with the following example
results in
simulation result |
Note, the approximate derivatives have a large error at the start of the simulation, because no information about the derivative of the signal is known. For this reason, the ApproximateDerivativeWithFilter block starts, for example, with steady-state (so zero derivative), and then needs some time until the approximation of the derivative is fine.