Computing group delay directly

3 次查看(过去 30 天)
Jackson Peacock
Jackson Peacock 2013-3-14
评论: SAM Arani 2021-5-12
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 个评论
SAM Arani
SAM Arani 2021-5-12
I happen to have same problem, Have you find the problem yet?

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by