# signal processing – Why these operations calculates group delay?

In textbook, group delay is defined as negative derivative of phase (in frequency domain). And in discrete signal, derivative can be approximately calculated as differentiation. But when I browse some source code, it calculates group delay in following approach that I completely don’t understand:

1. Calculate “energy centroid” by:

• fetch a frame of input wave;
• FFT to frequency domain (data1);
• multiply each input wave data by their index, FFT to frequency domain (data2)???
• treat data1 and data2 as arrays of 2D vector, not complex number, then dot-multiply them. the result is array of “energy centroid”.
2. Calculate energy spectrum by FFT input frame to frequency domain, then calculate power of each bin.

3. Group delay array is calculated as dividing “energy centroid” with energy spectrum.

It is obvious that these operations are far different from the definition in textbook. Could anybody help to explain why it gives group delay?

Read more here: Source link