Search code examples
matlabapproximationcalculus

Differentiable approximation of the round() Matlab function


Could you possibly suggest a differentiable approximation for the round Matlab function?

The round function looks like this:

enter image description here

I would like a differentiable function which [closely] resembles the one in the figure.


Solution

  • You could write the derivative using the dirac delta - it's called 'dirac comb'.

    Also you can write the round function as sum of the Heaviside step functions.

    for both there are many approximations - just select a differentiable one.