# Analog Equivalent Circuit of an easing function

I am trying to wrap my head around wether and with which circuit it would be possible to emulate the behaviour of a digital easing function like output += delta_to_target_value * easing_factor as it is illustrated in a 2D-version here.

I know basic rise-/fall slew circuits, but I expect this is different.

My thoughts: Let's assume the target's value is a steady stream of random DC voltages, straight out of a Sample-and-Hold. I'd need to find the difference (delta) between target and final output. I then need to attenuate this delta with a easing-factor (< 1). In the digital loop I would then set the output value to equal the current output value plus the attenuated delta value. Somehow I am afraid It would not work that way in a time-continous system. Do I oversee anything here?

Edit:
Nevermind, I had some trouble wrapping my head aropund this. I ran a Circuit simulation with random stepped values and a RC-filter which yielded this result:

Simulation of RC Filter

And then used the same step values and programmed a the easing function I mentioned, which yielded a very very similar result as you can see:

Simulation of Easing Function

What I hoped for: I hoped for a read curve which does not appruptly change it's direction, maybe as if it had some sort of inertia. The delta in the mentioned easing function is way bigger with growing differences which results in a speedup at value changes. I would definitly know how to fix this in the digital domain, but I am not sure about the analog domain.

• It seems to me that an RC filter with an adequately long time constant would perform the required function. – Transistor Sep 29 '17 at 18:17
• Looks like a simple RC function to me... but your question is a tad confusing. – Trevor_G Sep 29 '17 at 18:17
• I will have a look at the simulations, and clarify once I got some fancy graphics : ) – ato Sep 29 '17 at 18:18
• If you need to change your requirements like that you should start a new question or it nullifies the existing answers..... and yes it is doable... fairly trivial analog computer stuff. – Trevor_G Sep 29 '17 at 20:30

I know basic rise-/fall slew circuits, but I expect this is different.

For a one dimensional signal it's very basic - it's an RC low-pass filter. Here is the transient response to a step change: -

Trace A is the step input and trace B is the output as indicated in the circuit below: -

And, just in case you have any doubt, you can take an analogue RC filter and digitize it as follows: -

So, if your digital algorithm matches the IIR one immediately above then you have the equivalent of an RC filter.

• Completely right. I actually build a simulation and found out that onedimensional easing looks just the same as a RC filter – ato Sep 29 '17 at 18:58
• @ato - you mentioned in the dit in your comment "maybe as if it had some sort of inertia" - if you need a more sophisticated function then simulate adding an inductor in series with the resistor. Make the resistor value small but not too small or the "inertia" will cause overshoot - i.e. make it critically damped for a slightly more realistic response. – Andy aka Sep 30 '17 at 8:20

\begin{align*} \Delta x &= k_{easing} \left(TARGET-x\right)\:\Delta t \end{align*}

Note that in the software case you referenced, it is implicit that $\Delta t=1$.

In a continuous system:

\begin{align*} \textrm{d} x &= k_{easing} \left(TARGET-x\right)\:\textrm{d}t\\\\ \end{align*}

The only difference between these is that $\Delta t$ is a finite variable and $\textrm{d} t$ is an infinitesimal variable. They are otherwise the same concept. The infinitesimal form being more of an "always true" kind of thing where the discrete form assumes you know average values.

Regardless, it all boils down to a first-order linear ordinary differential equation, whose solution is:

$$x=TARGET\cdot\left(1-e^{-k_{easing}\cdot t}\right)$$

This is exactly the same thing as you'd get in an RC circuit:

$$V_C=V_{IN}\cdot\left(1-e^{-\frac{t}{R C}}\right)$$

with $k_{easing}=\frac{1}{R C}$ and your target being $V_{IN}$.