# Goertzel algorithm magnitude

I'm reading a Goertzel algorithm paper and an embedded article. I have several questions:

1. I don't understand why the the magnitude is calculated as follows:

$$\text{Magnitude} = y^2[n-2] + y^2[n-1] - a * y[n-2]y[n-1]$$ where $a$ is some coefficient. Can someone elaborate on why this is the expression?

1. Minimum block size If I have a sampling rate of 4000 Hz and target frequency of 50 Hz, what is the minimum block size?

2. If block size more that magnitude will more accurate right?

• What are you not understanding? The first link shows a step-by-step derivation of the equation you're asking about. Sep 28, 2012 at 14:39
• How the step from Output and Input become to magnitude? Sep 28, 2012 at 16:14
• Great article here: asp.eurasipjournals.com/content/2012/1/56
– P i
Mar 15, 2014 at 19:29

## 1 Answer

[1] It's a notch filter. It attenuates everything but the frequency component you're interested in. The output is summed up over some time to make the tone detection more reliable. [2] There's no minimum block size. There's a requirement about the amount of time spent summing up the output. What you'll see is that the summed output over say 205 samples (at fs 8000kHz), grows much more if the input contains the frequency component you're interested in detecting.