help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

initial state argument to filter


From: bantone
Subject: initial state argument to filter
Date: Thu, 11 May 2006 13:14:25 +0200 (CEST)

Hi,

How exactly is the argument SI (initial state) for
the "filter" function handled?

I try to use the filter function as a simple harmonic oscillator.
y(n) = C * y(n-1) - y(n-2)
the frequency depends on C and the initial phase on the initial state.
I would expect that I get a cosine wave if I type something like
this:

y = filter([1,0,0], [1, -1.996, 1], zeros(1, 512), [1, 0.99]);

because 

y(1)= b(1)*x(1) -a(2)*y(1-1) -a(3)*y(1-2) = -(-1.996)*0.99 -1=0.97604
y(2)= b(1)*x(2) -a(2)*y(2-1) -a(3)*y(2-2) = -(-1.996)*0.99 -1.006=0.95818
...

instead I get

ans =

  1.0000  2.9860  4.9601  6.9143  ...

I expected y(1-2) and y(1-1) to be SI(1) and SI(2).
That would make sense to me.  Instead the initial state seems to
be just prepended to the input vector.  In other words the initial
state gets modified before the first output y(1) is calculated.
Is that the correct behaviour?

thanks,
anton


reply via email to

[Prev in Thread] Current Thread [Next in Thread]