> > I'm a little confused at the k value. Does it have to be an integer? I've
> > seen two variations of the calculation:
> > k = 0.5 * (N * Fi) / Fs
> > And
> > k = (N * Fi) / Fs
>
> k does not need to be an integer.

k does not need to be an integer. But if it isn't, there will
be aliasing from other frequencies whose periods are exact
submultiples on N, including DC (which isn't the case when
k is an integer). If this difference could cause any problems,
windowing before the Goertzel sum might help minimize some
of the results of this difference.
IMHO. YMMV.
--
rhn A.T nicholson d.0.t C-o-M

Reply by jens●March 15, 20062006-03-15

> I'm a little confused at the k value. Does it have to be an integer? I've
> seen two variations of the calculation:
> k = 0.5 * (N * Fi) / Fs
> And
> k = (N * Fi) / Fs

k does not need to be an integer. The 2nd equation is correct. In the
1st equation, it's probably supposed to be int(0.5 + ...), which will
round the number to the nearest integer (which isn't necessary, and in
fact can negate one great feature of the Goertzel algortihm, which is
being able to pick a frequency that isn't completely constrained by the
sample rate and block size).
Here's a great article about the algorithm, with the exception of
making k an integer:
http://www.embedded.com/story/OEG20020819S0057

> Which is correct? Does anyone know the math behind it?

The math behind the k value is the same as the bin # in an FFT, with
the exception that it doesn't need to be an integer.
Note that even though any frequency can be evaluated, the resolution
(and relative locations of side lobes) is still based on the sample
rate and block size.

Reply by Gary Landes●March 15, 20062006-03-15

I'm a little confused at the k value. Does it have to be an integer? I've
seen two variations of the calculation:
k = 0.5 * (N * Fi) / Fs
And
k = (N * Fi) / Fs
Which is correct? Does anyone know the math behind it?