# How to: Zero Delay State Variable Filter Part 3

### Zero delay feedback SVF

We will now build a linear and nonlinear zero delay feedback filters starting from the state variable filter differential equation

### Linear model

The linear model simply assumes the differential equation above, without adding any nonlinear elements. Changing the variables with more descriptive ones, we get

where $u(t)$ is the filter input function.

Starting with the trapezoidal rule

as in part 2, the expression for $bp_{t+1}$ becomes

where

The equation ultimately resolves to

This equation now has two unknown variables on the left hand side, $bp_{t+1}$ and $lp_{t+1}$, so we need to first express $lp_{t+1}$ in terms of $bp_{t+1}$ and $bp_{t}$.

Since $lp’(t) = bp(t)$, applying trapezoidal rule results into

which can now be substituted back into the first equation. Gathering $bp_{t+1}$ terms to the left-hand side of the equation after the substitution

or after combining terms and solving for $bp_{t+1}$

This and

provide the final closed-form time stepping equations for the linear model. In this case, fortunately, there was no need to solve an implicit equation with Newton’s method.

The pseudocode for the integration then looks like

The end product here is practically the same as what a semi-implicit integration would get you - the added benefit is the stability of the fully implicit integration.

However, it usually doesn’t make sense to apply implicit integration methods to fully linear differential equations. Nonlinear differential equations are where they show their teeth.

### Nonlinear model

Starting with the same differential equation as previously and adding $tanh()$ as nonlinear elements (which is what ideal transistor curves usually resolve to in circuits mathematically)

and once again applying the trapezoidal rule, first for $lp_{t+1}$ (which is trivial)

and for $bp_{t+1}$

which requires an implicit solution. Gathering $bp_{t+1}$ terms to the left-hand side of the equation, substituting for $lp_{t+1}$ and gathering the right-hand side as a constant

we get

Forming the Newton’s method iteration functions (see part 2), substituting $x=bp_{t+1}$, $a=lp_{t}$, $b=bp_{t}$ and $c=u_{t+1}$

and it’s derivative

which gets us the following to iterate Newton’s method with

Pulling it all together, the pseudocode for the filter is now

### Conclusions

We have now succesfully built a zero delay feedback filter and detailed the steps to achieve it. It is left to the reader to experiment and determine if zero delay feedback is actually worth the trouble.