# Group Delay of Mulitrate system

how do I find the group delay of multirate system.(sample rate converter) , IIR non-linear phase filter

Say decimation by 2 (with lpf) = tf1(num,den)

then again decimation by 2 (with lpf) = tf2(num,den)

In total decimation by 4.

i can do the inidividual stages

gd1 = grpdelay(tf1,fvec,Fs)

gd2 = grpdelay(tf2,fvec,Fs/2)

but how do i find the combined one of the entire system

can two group delays be added ?

Edited :

Assuming the can be added, is the following scaling inside and outside the grpdelay function correct ?

gd1 = grpdelay(tf1,fvec,Fs)/Fs/2 % converting from samples to seconds

gd2 = grpdelay(tf2,fvec,Fs/2)/Fs/4

Then we can plot it

plot(fvec/,gd1+gd2);

xlabel('Freq MHz');

ylabel('Group Delay (s)');

• dsp.stackexchange.com/a/38676/8202 Yes, I believe you can sum them. – jojek Dec 11 '20 at 16:28
• is there some way to extract system group delay from time domain simulation to confirm this .. ? – BandW Dec 11 '20 at 18:08
• To answer your last comment/question please see this: dsp.stackexchange.com/questions/63141/… – Dan Boschen Dec 13 '20 at 14:18
• @DanBoschen thanks for your comment. Is there a way we can combine two tfs which are at different sampling rates, the matlab series function doesn't work if the fs is different. – BandW Dec 14 '20 at 16:47
• @DanBoschen can you please also comment on my edited portion . Thanks – BandW Dec 14 '20 at 17:03

## 1 Answer

If the group delay values you get are in seconds (rather than samples) then yes, you can essentially add the two group delays.

You can verify this by feeding an impulse padded with zeros into your system. You will get your filter response, which is then decimated and feed into your second stage. The second stage will also then apply it's filter and do it's decimation. Where the peak is in your output response is (relative to where the impulse is) will correspond to the group delay - this is of course assuming your filters have linear phase.

This is essentially determining an impulse response for your overall system, but your system is linear but it is not time invariant i.e. delaying your input by a sample will produce a different output not a delayed one, so it really isn't an "Impulse Response".

• Hi thanks for you reply. My filters are IIR (BLWDF), so non-linear phase. I think i can just add them up, but as you said it should be in seconds, so , can i write then : gd1 = grpdelay(tf1,N,Fs) / Fs/2 ; % to get it in seconds , since although the first stage is calculated at Fs, but the sample--> second transformation should be Fs/2 and then gd2 = grpdelay(tf2,N,Fs/2) / Fs/4 ; similarly, the second stage is calculated at Fs/2, but the sample--> second transformation should be Fs/4 and g_total = gd1+gd2 ? – BandW Dec 14 '20 at 16:36
• @BandW - When the filters have non-linear phase, then each frequency has it's own group delay. You would add the group delays values for the same frequency. So the group delay calculation really only makes sense for the passband region of the last filter. If the group delay at 100 Hz in the first filter is 2.1 secs and the group delay at 100 Hz in the second filter is 0.5 secs - the total group delay at 100 Hz is 2.6 secs. – David Dec 14 '20 at 16:47
• yes, thats correct, the freq vector would be same, my question is what does seconds means wrt to two plots, that depends on the sampling freq.. if you look carefully at my gd1 and gd2 in the above comment... the Fs is different for gd1 and gd2 in the grpdelay function , also after the grdelay is claculated its normalized by Fs/2 or Fs/4.... i am asking whether the Fs inside grpdelay function is correct.. and outside normalization is correct ? Thanks a lot – BandW Dec 14 '20 at 16:53
• @BandW Yes, I believe this is correct. For the first filter, it is applied at the sampling rate $Fs$ and the you calculate the delay for the down sampled output by multiplying by Fs/2. The same process for the 2nd filter - so I believe what you have is correct. To check it - you could try it with some simple linear phase FIR filters. – David Dec 14 '20 at 19:22
• @BandW I've thought about it some more and I think your modification is correct. Since the group delay is cause by the filter, you multiply the delay in samples by the sampling rate to get the delay in seconds. Once the delay is in seconds it would be unaffected by the decimation factor. – David Dec 17 '20 at 17:48