help-octave
[Top][All Lists]

## filter.oct function

 From: E. Joshua Rigler Subject: filter.oct function Date: Mon, 30 Apr 2001 19:12:47 -0600

```OK, this is more of a math question rather than octave specific, but
hopefully somebody will pity me for my ignorance ;^)...

I have an IIR 1-step predictive filter that looks like this...

theta = [a1, a2, a3...am, b1, b2, b3...bm]'

where the a's operate on the lagged measured output y(t), and the b's
operate on the process input x(t).  (Note the lack of a0 and b0...this
is intentional)

It should operate like...

yhat(t|t-1) = b1*x(t-1) + b2*x(t-2) + ... + bm*x(t-m)
- a1*y(t-1) - a2*y(t-2) + ... + am*y(t-m)

When I compare my model output to measured output, it matches quite
nicely, except that all modeled output is lagged by a single time step
(i.e. yhat(t)~y(t-1)...this is really only noticeable at sharp peaks in
my signal, but if I shift my modeled signal by 1 time unit, my
mean-square-error drops by 1/3!).  I used my own convolution program to
do this.  It's slow, but I think it is coded correctly, and for the life
of me I can't figure out where the 1-step lag is coming from

1st, any suggestions about the lagged model output?

2nd, is there something like "filter.oct" that will convolve an IIR
filter with both an input signal and lagged measurements?  Filter.oct is
designed to work with a filter designed by using model output as
feedback, whereas my filter is designed to operate on lagged measurement
output.  Most likely it's unstable otherwise.  In other words, if you
take the prediction equation above, and replace all the y's (on the
right hand side) with yhat's, I think this is what Octave's filter.oct
expects.

Actually, after a little review, I think the proper terminology for what
I have is that it is derived from an "equation-error formulation" of the
difference equation, whereas Octave expects something derived from an
"output-error formulation"...if that helps you understand my problem
better.

-EJR

P.S. For grins I tried using my filter with Octave's "filter.oct"
routine.  I seeded it with the first M-1 measured output values.  Sure
'nuf, it was unstable, and blew up quite badly in very little time!  The
strange thing is is that the absolute value of the sum of my A
coefficients is less than 1.  I thought this guaranteed stability, so
that I didn't have to resort to solving for the roots of my transfer
function.  Was I wrong?  Should I quit now and go take a real signal
processing class?  Forgive a naive aerospace engineer.

-------------------------------------------------------------
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
-------------------------------------------------------------

```