문제

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.

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top