Domanda

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.

È stato utile?

Soluzione

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.

Altri suggerimenti

Well, y=x is differentiable and, if you stand far enough back, looks exactly like your target function. It does differ from round in that it maps reals to reals rather than reals to integers.

I don't think it makes sense to talk about the differentiability of functions from the reals to the integers for anything other than trivial functions such as f(r) = 1 for all r in Reals.

You can probably get something closer to the step function by a judicious choice of trigonometric function. For example, this

enter image description here

is a plot of sin(x)+x. If I had more time I could probably tweak it to pass through (k,k) for all integers k, but I haven't so I'll leave that to you or other passers-by.

The derivative of your function is 1 almost everywhere. If possible merely use 1.

If you really need to make the function smooth, consider using a low-pass filter.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top