help-octave
[Top][All Lists]

## Re: implementing filters

 From: E. Joshua Rigler Subject: Re: implementing filters Date: 21 Oct 2001 13:36:08 -0600

```Matt,

If you flip the "k" and "n" in your equations, and write them out
longhand (i.e. don't use a summation operator), you have almost exactly
what I wrote, except that the filter on the left hand side is simply 1.
"k" indexes the actual "time", "n" indexes the filter lag.

Still, my question remains.  I'll see if I can restate it a little more
clearly.  Working through the algebra on a set of equations using "q" as
a delay operator, I ended up with the following (now using "n" and "k"
as you suggest):

F(q) * yf(n) = y (n)

The way I understand it, the reason for using the delay operator "q" is
so that simple algebra can be performed to change the previous equation
into:

1
yf(n) =  ---- y(n)
F(q)

My confusion arises when I try to figure out what the difference
equation for this is, and how to implement it in Octave.  My thought is
that the difference equation should be:

yf(n) = -1 * ( f(1)*y(n-1) + f(2)*y(n-2) +...+ f(k)*y(n-k))

...and the equivilant in Octave would be something like:

yf = filter ( [0,-1*F], 1, y);

This is really just a tricky convolution.  However, I'm not getting
quite the results I expect when I implement the filter.  It might be
that my initial math is flawed (the algebra that gave me the first
equation in this email), but I don't think so because this result
matches a similar derivation in a system identification book I have.

...

If this helps you to understand my problem better, my motivation is to
develop a simple "output error" causal IIR model (i.e. an OE model).
This is a relatively simple nonlinear model, to be used in a system
identification context.

It is derived from the "equation error" formulation of an AutoRegressive
model with eXogenous input (i.e. an ARX model).  The "noise" of the ARX
model is introduced within the model itself, and is thus "colored" by
the model's denominator dynamics (i.e. the recursive portion of the
model you described below):

ARX:
B(q)            1
y (n) =   ------ u(n) + ------ v(n)
F(q)          F(q)

The OE model theoretically has only measurment noise, which assumed to
be uncolored, or "white noise":

OE:
B(q)
y (n) =   ------ u(n) + v(n)
F(q)

( u(n) is the input, v(n) is white noise)

My original equation is an attempt to cancel the colored noise of the
ARX model.  I iteratively filter my model input and output with the
1/F(q) filter shown far above, solving for new filter coefficients each
time, until convergence is achieved.  This is supposedly referred to as
"repeated least squares", but I have had trouble finding any literature
describing exactly how to implement this technique in optimal filter
parameter estimation.

Hoping for further feedback,

-EJR

On Sun, 2001-10-21 at 09:30, Matt Flax wrote:
> Hi Josh,
>
> I'm terribly confused your equation had no time differences in it ... just
> plain 'k'. It also had no input signal.
>
> ... lets start again ....
>
> Say you have a system defined by :
>
> y(n) + SUM{ y(n-k)F(k+1) } = x(n)d(1) + SUM{ x(n-k)d(k+1) }
> Where k>=1 and 1<=n<=length(x)
>
> Well, here we have an input 'x' and output 'y'. 'k' are the time
> differences and 'n' is the current point in time.
>
> Generally you have to have at least one input ... even if it only happens
> at time=0. It should also be a non zero input at ome point in time.
>
> --
> Matt
>
> For electronic musicians ...
> Vector Bass          : http://mffmvectorbass.sourceforge.net/
> For developers ...
> 3D Audio Library     : http://mffm3daudiolib.sourceforge.net/
> Multimedia Time Code : http://mffmtimecode.sourceforge.net/

-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

```