I studying effects of digital filters group delay (IIR). In Matlab there is a function grpdelay which allows for particular frequency get a value of delay in samples

But after filter applying and comparing of pictures there are diffent results. In rude words if I expect 50 samples delay under grpdelay analysis, in fact I see 100 samples, If I expect 30, I see 70 and so on. What I doing wrong? I use simple sin processed gauss window for example

close all;

t = 0:0.008:600;

x = sin( 2 * pi * t * 1.3 ) .* gausswin(length(t) )';
x = [ zeros(1, 1000) x zeros(1, 1000) ];

fs = 125;
fc_low = 0.5;
fc_high = 3;
order = 4;

[b,a] = butter(order, [ fc_low/(fs/2), fc_high/(fs/2) ] );          
y = filter(b, a, x);


hold on;


legend('orig', 'filtered')


grpdelay(b, a, 512, fs);

below there is example of theoretical and model misfitting

enter image description here

enter image description here

So, the result is that Matlab function grpdelay gives not accurate results or I have errors in calculation/interpretation ?

  • 1
    $\begingroup$ The likelihood that a well established MATLAB function is wrong is extremely low, so chances are it's your code or interpretation. Please post your actual code you used to make the graphs. What you currently have in your are just a few fragments. $\endgroup$ – Hilmar Feb 2 at 14:45
  • $\begingroup$ Thanks! I posted whole code $\endgroup$ – the_jack Feb 2 at 18:01
  • $\begingroup$ Your picture suggests you have misunderstood group delay. You are apparently measuring phase delay. $\endgroup$ – Jazzmaniac Feb 2 at 18:22
  • $\begingroup$ I don't think so. In Openheim book, chapter 5 there are the similar example and understanding of group delay as I did $\endgroup$ – the_jack Feb 2 at 18:40
  • $\begingroup$ You should have a look here Phase/Group-Delay. $\endgroup$ – Irreducible Feb 3 at 6:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.