# More on Sliding Goertzel Correction

Started by August 10, 2003
```As Rick showed in previous post, the normal Goertzel's v(4), is:

v(4)=x(4)+a*x(3)+(a^2-1)*x(2)+(a^3-2*a)*x(1)+(a^4-3a^2+1)*x(0)

the sliding Goertzel (SGA) for v'(5) is

v'(5)= x(5)-x(0)-v(3)+a*v(4)

or after a lot of algebra:

v'(5)=x(5)+a*x(4)+(a^2-1)*x(3)+(a^3-2*a)*x(2)+(a^4-3a^2+1)*x(1)+(B-1)*x(0)

where B=a^5-4a^3+3a

If we assume that instead of subtracting x(0) in v'(5) we subtracted
B*x(0)=(a^5-4a^3+3a)*x(0) then the last term would have vanished.

If the last term B*x(0) vanishes and I calculate v'(6) as

v'(6)=x(6)-B*x(1)-v(4)+a*v(5)

then I get after more algebra

v'(6)=x(6)+a*x(5)+(a^2-1)*x(4)+(a^3-2*a)*x(3)+(a^4-3a^2+1)*x(2)

the SGA we are looking for.

Restating B:  B=a*(a^4-4a^2+3). This looks like some kind of series,

Since we stopped the real GA at N=4, then I propose without proof because I
haven't figured it out yet so this may be completely wrong that

B=a*SUM[a^n-n*a^(n-2)+(n-1)*a^(n-4)-(n-2)*a^(n-6)+......}

where n is the iteration number that we stop calculating the actual GA.  I'll
look in my series book and see if this series resolves to something neat.

On the other hand, just because this works for N=4 doesn't mean this analysis
works for N=100.  Also even though I double checked my algebra, this idea needs
verification.

Dennis

```
```Whoops.  Sorry the below is not the correct solution.

The last term of GA of v(6) is

v(6)=x(6)+.............+(a^6-5a^4+6a^2-1)*x(0).

The last term does not equal the B summation series below.

Back to the drawing board.  Sorry if I wasted any ones time.

Dennis

Dennis@NoSpam.com wrote:

>As Rick showed in previous post, the normal Goertzel's v(4), is:
>
>v(4)=x(4)+a*x(3)+(a^2-1)*x(2)+(a^3-2*a)*x(1)+(a^4-3a^2+1)*x(0)
>
>the sliding Goertzel (SGA) for v'(5) is
>
>v'(5)= x(5)-x(0)-v(3)+a*v(4)
>
>or after a lot of algebra:
>
>v'(5)=x(5)+a*x(4)+(a^2-1)*x(3)+(a^3-2*a)*x(2)+(a^4-3a^2+1)*x(1)+(B-1)*x(0)
>
>where B=a^5-4a^3+3a
>
>If we assume that instead of subtracting x(0) in v'(5) we subtracted
>B*x(0)=(a^5-4a^3+3a)*x(0) then the last term would have vanished.
>
>If the last term B*x(0) vanishes and I calculate v'(6) as
>
>v'(6)=x(6)-B*x(1)-v(4)+a*v(5)
>
>then I get after more algebra
>
>v'(6)=x(6)+a*x(5)+(a^2-1)*x(4)+(a^3-2*a)*x(3)+(a^4-3a^2+1)*x(2)
>
>the SGA we are looking for.
>
>Restating B:  B=a*(a^4-4a^2+3). This looks like some kind of series,
>
>Since we stopped the real GA at N=4, then I propose without proof because I
>haven't figured it out yet so this may be completely wrong that
>
>B=a*SUM[a^n-n*a^(n-2)+(n-1)*a^(n-4)-(n-2)*a^(n-6)+......}
>
>where n is the iteration number that we stop calculating the actual GA.  I'll
>look in my series book and see if this series resolves to something neat.
>
>On the other hand, just because this works for N=4 doesn't mean this analysis
>works for N=100.  Also even though I double checked my algebra, this idea needs
>verification.
>
>Dennis

```
```Dennis@NoSpam.com wrote:

>As Rick showed in previous post, the normal Goertzel's v(4), is:
>
>v(4)=x(4)+a*x(3)+(a^2-1)*x(2)+(a^3-2*a)*x(1)+(a^4-3a^2+1)*x(0)
>
>the sliding Goertzel (SGA) for v'(5) is
>
>v'(5)= x(5)-x(0)-v(3)+a*v(4)
>
>or after a lot of algebra:
>
>v'(5)=x(5)+a*x(4)+(a^2-1)*x(3)+(a^3-2*a)*x(2)+(a^4-3a^2+1)*x(1)+(B-1)*x(0)
>
>where B=a^5-4a^3+3a
>
>If we assume that instead of subtracting x(0) in v'(5) we subtracted
>B*x(0)=(a^5-4a^3+3a)*x(0) then the last term would have vanished.
>
>If the last term B*x(0) vanishes and I calculate v'(6) as
>
>v'(6)=x(6)-B*x(1)-v(4)+a*v(5)
>
>then I get after more algebra
>
>v'(6)=x(6)+a*x(5)+(a^2-1)*x(4)+(a^3-2*a)*x(3)+(a^4-3a^2+1)*x(2)
>
>the SGA we are looking for.
>
>Restating B:  B=a*(a^4-4a^2+3). This looks like some kind of series,
>
>Since we stopped the real GA at N=4, then I propose without proof because I
>haven't figured it out yet so this may be completely wrong that
>
>B=a*SUM[a^n-n*a^(n-2)+(n-1)*a^(n-4)-(n-2)*a^(n-6)+......}
>
>where n is the iteration number that we stop calculating the actual GA.  I'll
>look in my series book and see if this series resolves to something neat.
>
>On the other hand, just because this works for N=4 doesn't mean this analysis
>works for N=100.  Also even though I double checked my algebra, this idea needs
>verification.
>
>Dennis

The B summation definition above was wrong.

In order to get B a second algorithm iteration has to be run when the GA
algorithm is run.  What we are trying to do here is capture the multiplier of
x(0) on the last or Nth iteration of the GA so that we can find B.

if we define X0(n) as the nth iteration of the X(0) term then

X0(n)=-X0(n-2)+a*X0(n-1)

where X0(0)=x(0), X0(1)=a*x(0)

X0(2)=-X0(0)+a*X0(1)=(a^2-1)*x(0)

X0(3)=-X0(1)+a*X0(2)=(a^3-2a)*x(0)

and so forth.

Thus for n GA iterations B=X0(n)/x(0).

This can be unstable for very small x(0). Since we are only interested in B we
can set x(0)=1 at the start for we don't need it only it's multiplier B.

For the first sliding Goertzel (SGA) at n+1 where v' denotes SGA

v'(n+1)=x(n+1)-B*x(0)-v(n-1)+a*v(n) note: this x(0) would be the real x(0) and
not 1.

and

v'(n+2)=x(n+2)-B*x(1)-v(n)+a*v(n+1)

and so forth.

Any thoughts?

Dennis

```
```On Sun, 10 Aug 2003 23:51:33 -0500, Dennis@NoSpam.com wrote:

(snipped)
>
>Any thoughts?
>
>Dennis
>

Hi dennis,
I'm not ignoring you.  When I get time, I want
to join you in looking carefully into these issues.
(I'm working on a project, 60 hrs/week, that
will be complete by the middle of September.)

See Ya,
[-Rick-]

```
```ricklyon@REMOVE.onemain.com (Rick Lyons) wrote:
>Hi dennis,
>  I'm not ignoring you.  When I get time, I want
>to join you in looking carefully into these issues.
>(I'm working on a project, 60 hrs/week, that
>will be complete by the middle of September.)
>
>See Ya,
>[-Rick-]

Hi Rick,

I tried the new SGA on some real data using the -B adjustment but I must have
had a coding error  in C++ or didn't line up the starting points correctly
because it didn't match the GA on the same data as I slid the data forward and
recalculated the GA.

What I plan to do is generate some known sinusoids and test the SGA against the
GA on the known data.

mqsymth@yahoo.com

```
```On Sun, 17 Aug 2003 17:06:03 -0500, Dennis@NoSpam.com wrote:

>ricklyon@REMOVE.onemain.com (Rick Lyons) wrote:
>>Hi dennis,
>>  I'm not ignoring you.  When I get time, I want
>>to join you in looking carefully into these issues.
>>(I'm working on a project, 60 hrs/week, that
>>will be complete by the middle of September.)
>>
>>See Ya,
>>[-Rick-]
>
>Hi Rick,
>
>I tried the new SGA on some real data using the -B adjustment but I must have
>had a coding error  in C++ or didn't line up the starting points correctly
>because it didn't match the GA on the same data as I slid the data forward and
>recalculated the GA.
>
>What I plan to do is generate some known sinusoids and test the SGA against the
>GA on the known data.
>