help-octave
[Top][All Lists]
Advanced

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

Re: initial state argument to filter


From: David Bateman
Subject: Re: initial state argument to filter
Date: Thu, 11 May 2006 14:14:51 +0200
User-agent: Mozilla Thunderbird 1.0.6-7.6.20060mdk (X11/20050322)

address@hidden wrote:

>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
>_______________________________________________
>Help-octave mailing list
>address@hidden
>https://www.cae.wisc.edu/mailman/listinfo/help-octave
>
>  
>
For our purposes the correct behavior is whatever matlab does.. Matlab
R14sp2 returns

y =

  Columns 1 through 7

    1.0000    2.9860    4.9601    6.9143    8.8408   10.7320   12.5803 ...

So I suppose octave therefore has the correct behavior. Understand what
is that behavior, that is another problem :-)

Regards
David


-- 
David Bateman                                address@hidden
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary



reply via email to

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