Adjustable Notch Filter help I'm converting the simulink diagram found in this paper to C code.  I'm not familiar with matlab/simulink(too expensive) so need help interpreting the diagram.  The problem I experience is that once a value like $\theta$, or $x_1$ becomes zero, zero is propagated everywhere due to the multiplication.  The paper states that the integrators are initialized to zero, so I don't see how the system works.

Any ideas?

Below is the simulink diagram and my C code:

The block diagram is found in the paper above as Figure 1 and Figure 2 :



typedef struct  { float zeta,gamma;} PARAM_ANFfloat;
typedef struct  { float err,regressor,x1,theta;} STATE_ANFfloat;

typedef struct {PARAM_ANFfloat p;STATE_ANFfloat s;} ANFfloat;

void dspANFfloat_perform(ANFfloat *anf, float y)
{
    anf-&gt;s.err = y - anf-&gt;s.regressor;

    anf-&gt;s.theta = -anf-&gt;p.gamma * anf-&gt;s.x1 * anf-&gt;s.theta * anf-&gt;s.err;

    anf-&gt;s.x1 = anf-&gt;s.theta * anf-&gt;s.err * 2 * anf-&gt;p.zeta - anf-&gt;s.x1 * - anf-&gt;s.theta * anf-&gt;s.theta;

    anf-&gt;s.regressor = anf-&gt;s.x1;

}
In this line:


  anf->s.theta = -anf->p.gamma * anf->s.x1 * anf->s.theta * anf->s.err;


you seem to be conflating $\theta$ and $\dot{\theta}$ (the derivative).

Equation 5 of the paper is:

$$
\dot{\theta} = -\gamma x_1 \theta \left[ y(t) - \sum_{l=1}^n \dot{x}_l \right]
$$

Note that the left-hand term is the derivative of $\theta$, not $\theta$ itself.