0
$\begingroup$

This question already has an answer here:

Despite,reading up on this I'm unable to find crystal clear clarity on the differences b/w phase and grpdelay functions and interpretation of grpdelay's output. I have designed a low pass butterworth filter having a cut off frequency of 0.04Hz. There is a delay in my filtered output compared to my original signal. I wish to know this delay. I used the grpdelay function in matlab (grpdelay(b,a,N/2) ). And this is the output i got.enter image description here. I read that grpdelay is supposed to give the phase responses as a function of frequencies. In my image, the cursor points to the cut-off freq. How exactly do I know the delay in my filtered output through this? Is it the corresponding value on the Y-axis?

Plotting the phasedelay(b,a), gave this as the output.enter image description here.Here,the phasedelay value at cut-off is different.

My question is, to figure out how much the filter has delayed the signal,which function do I use? And how do I interpret the output exactly, of that function?

Here is my original signal in blue and the filtered signal which has the delay in redenter image description here .enter image description here

$\endgroup$

marked as duplicate by jojek, endolith, Jason R, Peter K. Aug 2 '14 at 1:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ I did read that yes, but still had a lingering doubt. Phase delay gives me the phase angle at a particular point in frequency whereas group delay gives me the rate of change of phase around that point. So, in answer to my question, phasedelay function is the one I should go for? To just figure out how much the filter delayed the signal i mean. $\endgroup$ – userminerva Jun 30 '14 at 8:03
  • 1
    $\begingroup$ also take a look at what wikipedia says about it . i am pretty sure what is said in that introduction is correct. phase delay is about how much time the sinusoid (at some known frequency) is delayed and group delay is about how much time the envelope governing that sinusoid (of the same frequency) is delayed. they are not necessarily delayed the same amount of time (but they are if it's a linear-phase filter, then group and phase delay is the same and constant for all frequencies). $\endgroup$ – robert bristow-johnson Jun 30 '14 at 20:12
  • $\begingroup$ Do these help? en.wikipedia.org/wiki/File:Wave_group.gif en.wikipedia.org/wiki/… $\endgroup$ – endolith Jul 1 '14 at 2:06
5
$\begingroup$

If you are looking for a frequency-independent delay applied to any given input signal by the filter (apart from amplifying and attenuating certain frequency components), then you won't be able to find it because there is no such delay. As you can see in your plots, group delay and phase delay are generally frequency dependent. Furthermore, for general input signals, the terms group delay and phase delay have no meaning.

There are two cases for which the terms group delay and phase delay have a clear meaning. The first is for narrow-band input signals

$$x(t)=a(t) \cos(\omega_0 t)$$

where $a(t)$ is a low-pass signal. If the system has an approximately constant amplitude response in the frequency range of $x(t)$ (i.e., around $\omega_0$) which is $\left|H(j \omega_0)\right|$, and if its phase is approximately linear in this frequency range, then it can be shown that the output signal is approximately given by

$$y(t) \approx \left| H(j \omega_0) \right| a(t-\tau_g(\omega_0)) \cos\left( \omega_0(t-\tau_\phi(\omega_0)) \right)\tag{1}$$

where $\tau_g(\omega_0)$ is the system's group delay evaluated at the carrier frequency $\omega_0$, and $\tau_\phi(\omega_0)$ is the phase delay at $\omega_0$. So in this case the group delay is the delay of the envelope, whereas the phase delay equals the delay of the carrier. A special example of such a narrow band input signal is a pure sinusoid. From (1) it is clear that the delay of a pure sinusoid when passing through a linear time-invariant (LTI) filter equals the phase delay evaluated at the sinusoid's frequency (and not the group delay). Note that in the case of a pure sinusoid (i.e. $a(t)=\mbox{const}$), Equation (1) becomes exact for any LTI system.

The other case where these terms are meaningful is when the system has exactly linear phase. This is only possible for FIR systems. For FIR filters with even symmetry of the impulse response, the group delay and the phase delay are equal and constant. In this case, they simply specify the delay of the input signal. This is possible because both group delay and phase delay are constant, i.e. frequency independent.

From your question, I believe that you are looking for such a delay. However, as explained above, such delay only exists for linear-phase FIR systems, not for the Butterworth filter you are considering.

$\endgroup$
  • $\begingroup$ yes, butterworth,iir, filters do not have linear phase as you said,and since the phase delay and group delay are not equal and constant, and therefore are frequency dependant, how can i calculate the delay due to this filter? $\endgroup$ – userminerva Jun 30 '14 at 9:13
  • 1
    $\begingroup$ @usersandie: You can't, unless you define exactly what you are talking about. What exactly do you mean by delay? The time it takes until you get the first non-zero output sample (assuming zero initial conditions), the delay of the envelope (if there is any), the delay of the frequency component at 1000Hz, etc.? $\endgroup$ – Matt L. Jun 30 '14 at 9:19
  • $\begingroup$ @usersandie: You could provide a plot of your input and output signals, specifying the delay that you mean. But again, note that whatever you define will most likely only be valid for a certain class of input signals. $\endgroup$ – Matt L. Jun 30 '14 at 9:22
  • $\begingroup$ Also,i did read the first case as well and tried to apply it to my signal. The frequency response of the filtered signal shows a constant magnitude of 1 till about 0.01Hz(pass band).After which is the transition phase through cut-off freq to the stopband.The phase response isn $\endgroup$ – userminerva Jun 30 '14 at 9:25
  • $\begingroup$ @usersandie: For sufficiently narrow-band input signals the phase response is approximately linear in the given band, and the approximation (1) is valid. I.e. for a narrow-band signal in the passband of the filter, you can use this approximation. Note however, that in your case the signal must have a very small bandwidth because your filter has a narrow passband. $\endgroup$ – Matt L. Jun 30 '14 at 9:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.