# How to obtain a meaningful group delay graph using matlab

Problem: I'm trying to analyze the behavior of an FIR filter with the following impulse response/kernel: Using Matlab's function grpdelay(myKernel,length(myKernel)), I obtained the following figure: Based on my limited knowledge the graph is not correct since it contains negative values. Is my understanding correct? If it is, how could I go about obtaining a more accurate group delay graph?

Code:

    onePulseRun20 = dlmread("C:\Users\agusfrpa\Pictures\singlePulseRun20.txt");

%y is averaged one pulse data
y = mean(onePulseRun20,1);
pulse = twoPulseRun21(1,:);

myFilter = conj(fft(y))./(abs(fft(y)).^2+.3);
myKernel = real(ifft(myFilter));
myKernel = myKernel(4700:5250);

grpdelay(myKernel, length(myKernel));


• Data files: link and link – Agustin Pacheco Jul 25 '17 at 22:22
• You should read that I think : dsprelated.com/showarticle/69.php . I'm not sure you can use grpdelay() the way you are – Florent Jul 25 '17 at 23:13
• The group delay of a causal filter can become negative. If your impulse response and the corresponding group delay graph make sense is a different question, but the fact that the group delay is negative is no reason to conclude that the graph doesn't make sense. – Matt L. Jul 26 '17 at 7:49