Computing group delay directly

10 views (last 30 days)
Jackson Peacock
Jackson Peacock on 14 Mar 2013
Commented: SAM Arani on 12 May 2021
In an attempt to better understand group delay, I tried writing simple code to compute it based directly on it's definition, rather than using the existing grpdelay function (with it's fancy efficient DFT based algorithm). My results weren't even close to those found with grpdelay, and I'm trying to figure where I went wrong.
Group delay is defined as the (negative) derivative of phase response, so given the filter coefficients a & b, and sampling rate fs I tried approximating the derivative like so:
[h f] = freqz(b, a, N, fs);
g1 = -diff(unwrap(arg(h)))./diff(f)/(2*pi);
Since arg(h) has units of radians and f has units of Hz, I would expect this to give the group delay in seconds, at each of the frequencies in f. To get the same using built-in matlab commands, I computed
g2 = grpdelay(b, a, f, fs)/fs;
The results of these two are not at all similar. What am I doing wrong?
  1 Comment
SAM Arani
SAM Arani on 12 May 2021
I happen to have same problem, Have you find the problem yet?

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!