**(So far, 102 people got it right out of 229 for a success rate of 44%)**

(Thank you to Rick Lyons, author of the top-selling book Understanding Digital Signal Processing, for submitting this Quiz Question.)

Equation (1) gives the z-domain transfer function of a digital IIR bandpass filter.

$$H(z)=\frac{0.136728736(1-z^{-2})}{1 -0.53353098z^{-1}+0.726542528z^{-2}}.\qquad\qquad\qquad\qquad(1)$$

Assuming a filter input sample rate of 1000 samples/second, Figure 1 gives the positive-frequency magnitude, phase, and group delay responses of the Eq. (1) bandpass filter.

** Question:** If we apply a 200 Hz sine wave signal
to the bandpass filter's input, what will be the time delay (measured in
seconds) between the filter's input 200 Hz sine wave and the output 200 Hz sine
wave?

- Comments
- Write a Comment Select to add a comment

Hi Guys. In Prof. Mitra's DSP book I ran across an IIR bandpass filter whose resonant frequency phase delay (time delay through the filter) is zero seconds. That seemed novel to me. But more importantly, it reminded me that the time delay of a single sine wave through a nonlinear-phase filter is is determined by the filter's phase delay and NOT the filter's group delay.

It's easy to fall into the trap of thinking that the time delay through an arbitrary filter is is determined by the filter's group delay. But that's only true for linear-phase filters. Thus I conceived of my Quiz Question. And Herr Holzmayer is correct. I included the IIR filter's group delay information in the Quiz Question merely to make the question more "tricky".

By the way, while phase delay is measured in seconds in the analog world, I've noticed that MATLAB's 'phasedelay()' function computes phase delay measured in samples.

May be i am wrong but i think that the meaning of group delay is true for every filter and represent (a part of) the true delay at each frequency. Constant group delay is important in the passband of a filter if the application need to conserve some features of the aspect of the signal, for example zero crossing.

In the case of the proposed quiz filter, remember that a 0 phase value does not mean a 0s delay. The true delay can be a multiple of the period of the sine signal.

How can i say that for the filter ?

The filter has a derivating property transforming low frequency sine signal to cosine signal. The phase is pi/2 rad for the very low frequencies, which does not means that the output signal starts a quarter of period "before" the input signal, but 3/4 of a period "after".

In the proposed filter, the 200 Hz signal is first derived (the Pi/2 offset of the phase), so the sine appears to be delayed by +PI/2=-3Pi/2 => 3/(4*200))= 3.7 ms. It is amplified or attenuated by the gain, and delayed by 6,3 samples = 6,3 ms. The total delay is 10 ms, looking like a 2 periods delay at 200Hz, similar to a 0s delay for a sine signal.

__So my answer is now that the delay of the filter is 10 ms, combining a derivation and a 6.3 samples delay at 200 Hz.__

I think that looking at the energy transfer delay through the filter can help in understanding this value but i have not looked at that for now. The basic idea for that it the fact that the impulse response of the filter is exponentially spread over time following an energy input at time 0. So this is also true for all other signals. The time constant of this exponential, linked to the bandwith of the filter, and to the steepness of the phase (the group delay value) around 200Hz is the key, i think...

Very very interesting quiz !!!

Any comment is welcome.

Take care of you an your family.

Hi codet, I think your explanation is the best among all I've seen. But I don't quite follow the mechanics of it.

By "derived" do you mean "differentiated?" If so, where in the filter's z-transform is this differentiator? The closest I can see is the $1 - z^{-2}$ term, but that is a two-step differentiator. Isn't a normal differentiator just $1 - z^{-1}$?

--Late-to-the-game

Hi Yates,

Thanks for your comment.

Yes, differentiated (sorry for the mistake, french confusion...). 1-z^-2 is the normal differentiator 1-z^-1 associated with the low pass FIR 1+z^-1. It is still a différentiator, symetrical and used when you dont want a half sample delay (for example in image processing we only used even ordre filter with odd number of samples in the impulse response in the X and Y directions), or if you dont want the differentiation effect in high frequencies where there is only noise.

1-z^-2 is a differentiator but with a lower range of frequencies compared than for 1-z^-1. If you look at the linear phase value for very low frequencies (also for f=0), it is Pi/2, caracteristic of a differentiator, and the gain is also approximatively linear in low frequencies.

I somewhat disagree with the answer. While it is true that there is _some_ filter response immediately from the Input, it takes a significant number of samples for the filter output to reach some appreciable level. At two times the group delay the signal appears to have reached roughly 70% of full output.

When I worked on microwave spectrum analyzers, the time to achieve full response through the (analog at the time) filters was a fundamental limitation on how fast the spectrum analyzer could sweep. Not allowing sufficient time resulted in "uncalibrated" measurements.

I think the same applies here. So the answer either should NOT be "zero", or you need a much better wording of what is being looked for.

A phase shift of 0 degrees does not mean no transient...

An IIR high-pass filter with a fc = 0.01 will have a phase of almost 0 degrees for f > 0.1 fs. Still the transient can take a long time to decay.

Hello Caradoc. My quiz question made no mention of the filter's time-domain transient response. Perhaps I should have worded my question as follows:

"If we apply a 200 Hz sine wave signal to the bandpass filter's input, what will be the *steady state* time delay (measured in seconds) between the filter's input 200 Hz sine wave and the output 200 Hz sine wave?"

It seemed like Joe misunderstood the relationship between the phase response and transient state and I tried to clarify it. I'm well aware that your question did not mention time-domain transient response.

Hi Joe West.

The correct answer is indeed zero seconds, But I'd sure be happy to hear your suggestion on how my quiz question could have been worded in a better way.

Your reply to Caradoc with the proposed revision to the question is a good start, since by specifying things in terms of "steady state" one can ignore the transient response.

With my spectrum analyzer experience I was quite aware of the transient response effects, which sent me off down a different track from what you in retrospect intended.

By the way, in the spectrum analyzer case I mentioned, as the local oscillator sweeps, the (presumed stationary) S.A. input signal gets swept across the filter bandwidth by the mixing process. So the stationary input signal is only in the passband of the filter for a brief time. As a consequence, "steady state" filter output becomes an "interesting" concept.

The phase delay is 0. But the group delay is 6.3 ms. From the way the question is worded, I think phase delay is the salient measurement. At the resonant frequency of 200 Hz, lag and lead cancel and the only delay you will detect is to the envelope of turning on the 200 Hz sinusoid. At steady state, no delay is detected at that frequency.

Since it's an academic example (like in school), I can only take what is given.

And I should not bother about things which are not.

Hence, we're dealing with a sine wave of 200 Hz.

A sine wave (and only that) does not have a beginning, so no transient contemplation is necessary.

Because any "start" of a sine wave would contribute additional frequency/energy/phase but we're not to solve that but answer the question for a pure sine wave of 200 Hz.

In this case, the answer is easily found in the phase plot.

The phase delay is exactly zero at 200 Hz.

Group delay is only interesting if we're talking of different frequencies ( a group ).

So, the group delay information is just for confusion and does not contribute to solve the task.

Holzmayer-

Practical answer, the best kind :-) But, at time zero output amplitude is far less than input amplitude. So there is a "visible" delay for an application that needs to do some practical thing -- like boot up.

-Jeff

Hi Jeff,

I agree that we're not able to demonstrate a steady sine wave and its continuing filter process without "seeing" initial effects,

however a sine wave of 200Hz would not be a sine wave if it had a transient part.

Therefore, no, my answer is not at all practical.

In school, and later during my studies, I was fascinated by partial differential equations and solving boundary value problems (I'm a strange guy, I know ;-).

So, when I came to LaPlaceTransformation and FourierTransformation, it was quite easy for me to differentiate between a steady state and the transient effects which real life produce - without headache.

It's always very difficult to transport the idea of a "theoretical" steady state observation to people who are used to think in terms of real-world-systems, as we have a problem to imagine the steady state of an LC-resonator without immediately being aware of the initial state where neither the L nor the C carries some energy.

However, in the steady state the energy is always there, and only changing its "place", and this forever and without any losses.

And, as far as I see, the described quiz task is of such a sort.

So, it's not a practical example. But because of this, the answer is easy and elegant.

Bernhard

But...

Rethinking my answer, and rereading the quiz, I come to another assumption:

since a sine wave has no beginning and no end, and since this is valid for input and output, this means, you cannot measure a "distance" in time/seconds.

Ergo: the question in the quiz might be an illegal question hence no solution.

However, I guess this answer would get me no points :-(

Bernhard

Bernhard-

An illegal question, hehe. I wonder if Rick will read this far down the org chart :-)

We should establish a rule: all quiz questions have to include "other" or "none of the above" so we can take issue with the question if needed.

Hi jbrower. I did be interested to hear any thoughts you have regarding my latest (April 27th) Comment to Bernhard Holzmayer.

You seem to be saying that it's an illegal question to ask, "What is the time delay between a sinusoidal input signal and the sinusoidal output signal of a digital filter?" Calling that question "illegal" would be, of course, nonsense. I'll debate this "illegal question" topic with you if you wish, but first I have a more interesting question for you.

If I understand your words, you said all sine waves have no beginning and no end. That is, all sine waves are infinite in time duration. If you are correct then we must conclude that a "sine wave" is an abstract concept (like a perfect circle or one of Euclid's lines that has infinite length but zero thickness) and, therefore, a sine wave does not actually exist in our real physical world.

So here's my serious question for you: If a "sine wave" does not exist in our physical world, what name can I give to the voltage signal coming out of the AC outlet of the wall in my house that is powering my desktop computer? If that AC voltage is not a sine wave then what is it?

Rich posed the following: "So here's my serious question for you:
If a "sine wave" does not exist in our physical world, what name can I
give to the voltage signal coming out of the AC outlet of the wall in my
house that is powering my desktop computer? If that AC voltage is not a
sine wave then what is it?"

Here's that ugly "real world" aspect again rearing it's ugly head.

If you look with an oscilloscope at what comes out of your wall socket, you will see significant distortion on the positive and negative peaks of the "sine wave".

Yeah, we call it a sine wave, and back at the power genaration station it is much closer to being sinusoidal. But by the time it reaches us, it's been distorted by the impedance of the distribution system interacting with the highly non-linear loads that our home electronics present to the power grid. It's pretty ugly. That is in part related to what drove the European regulatory bodies to mandate "power factor correction". (A huge topic in itself, you have to delve into three-phase power distribution systems, and way off topic here.)

So, strictly speaking, the power grid does NOT deliver a pure sine wave. But for practical purposes, calling it a sine wave is generally "good enough".

Joe. Sheece. I'm a retired EE and I spent 80% of my career in the laboratory. I've known about noise on AC power lines for 45 years. You're reading far to much into my question.

Bernhard made a statement that leads to the conclusion that sine waves do not exist. So I thought I'd ask him a question whose answer contradicts his statement. Perhaps my question should have been:

If a "sine wave" does not exist in our
physical world, what name can I give to the output voltage signal of a Hewlett-Packard sine wave generator? If that AC voltage is not a sine wave then what is it?

(Joe, there's no need to tell me about phase noise, or the harmonic content, of commercial signal generators.)

Hello Rick

Of course, we call it à sine wave. But in fact, it is only a part of a sine signal, starting sometimes in the past and ending when you shutdown the generator for example. Nobody has never seen(acquired) a sine. No time for that !! Only some part of it.

This is why spectrum analysers dont show delta functions for a sine input except if you catch precisely an integer number of period, with no noise. If not, they show you some kind of sin(x)/x spectrum centered on the sine frequency, (spectrum of the multiplication of a pure sine by a rectangular time window). They do FFT computations implying that the input signal is mathematically periodized, and, if you are lucky (integer number of period), you have a complete mathematic virtual sine, and only 1 point not null in its spectrum.

But, let us call a sine wave when we look at it on an oscilloscope.

Chris

Hi Chris (codet). Thanks. I was happy to read that someone in addition to me believes that sine waves exist.

Hi Rick,

I think there's some merit to the point. I wouldn't say "illegal," but answer me this: what's the difference between a 200 Hz sinewave delayed by 1 second and a 200 Hz sinewave delayed by 0.005 seconds?

Tying this into the quiz question, it may have been better (for a sine wave) to have the options as 1) 0 + n*5 milliseconds 2) 1.3 + n*5 milliseconds, and 3) 2.6 + n*5 milliseconds. Of course n can be any integer.

I can't explain the simulation presented though...I'll offer up this link as making a good case for the 6.3 msec delay:

https://dspillustrations.com/pages/posts/misc/grou...

(yeah seems a like dodgy website but there seems to be a real person behind it).

So I'm really curious now...

Hi lamabrew. Your words: "yeah seems a like dodgy website but there seems to be a real person behind it." seem interesting to me but I don't know what they mean.

Anyway, please see my Comment above that begins with the words: "Some additional words from Lyons".

Hi Rick,

Sorry, *dodgy *was not the best choice of words. I just meant that with all of the various share buttons, etc., with just a quick look more like some sort of link farm.

After discovering it I poked around and I think the author's put some serious work in to it.

My comment was meant to encourage people to poke around as I think the readership interests overlap.

With regard to the question the clarification makes sense. It also takes the mystery out of the question.

I think it was good as originally stated as it got the conversation going and people to think about the basic assumptions. And nobody here is going to give you a hard time over it :-)

HI lamabrew. Thanks for you clarifications.

I agree with Robert, Phase delay is the correct measure.

Running your filter through the ASNFD, I got the following results:

which confirms that the phase delay is zero at 200Hz. This is further confirmed via the the signal analyser for a 200Hz sinewave:

Nice question,Rick!

with warm regards,

Sanjeev.

Nice quizz ! answer is 0 (phase value) for the pure sine.

Here is a simple code to show the difference between phase and group delay. The modulation xm at fm is delayed by the value of the group delay around fx (figure 2), but the carrier x at fx is not delayed because the phase is 0 figure 1).

fs=1000;

fx=200;

fm=20;

n=100;

x=sin((1:n)/fs*2*pi*fx);

a=[1 -0.5335 0.7265]

b=[1 0 -1]

K=1/8;

freqz(b,a);

y=filter(b,a,x)*K;

plot([x' , y'])

xm=sin((1:n)/fs*2*pi*fm);

x1=x.*xm;

y1=filter(b,a,x1)*K;

plot([y1',xm'])

Setting up a complex sinewave at 200Hz + noise, and applying AM (5Hz) we get the blue signal (only real shown). Taking the abs() of the result, we get an envelope (red signal). Shifting the envelope left by 6 samples (i.e. the group delay) we see that the two line up nicely.

Hi Sanjeev (asn). Thanks for your plot. I really like your idea of estimating group delay by computing the envelope of a filtered amplitude modulated (AM) 200 Hz carrier signal. Below is the result of my duplication of your group delay estimation technique using MATLAB.

The red curve is the envelope of the filter's output after being shifted earlier-in-time by six samples. If you carefully look at my above figure you'll see that to have the blue square's amplitudes and the red curve amplitude match ("line up") perfectly then I'd have to shift the red curve ever so slightly more to the left. That means the filter's group delay is slightly larger than six samples. And that agrees reasonably well with the theoretical group delay value of 6.3 samples at a frequency of 200 Hz.

Sanjeev, it looks like the theory of group delay may actually be correct!

Nice explanation as ever, Rick! Your quiz made me think about publishing a more detailed article on the subject.

I'll have think, and keep you informed.

Take care, Sanjeev.

Rick, here's a definition of group delay, before we get into the formula for computing it.

In signal processing, **group delay** is the time delay of the amplitude envelopes of the various sinusoidal components of a signal through a device under test

But in the example of a sinusoidal signal, the envelope is a constant, so __any____ __answer would be a correct delay. Here is an example where there is an envelope: plot

Hi Charlie. Nice to hear from you.

I definitely agree with your definition of group delay. Charlie, do you think my answer to the Quiz Question is correct?

Great question and love the clarification between "Time Delay" and "Group Delay" and reminder that they are NOT the same. A very easy way to see (for the EE's) that the actual time delay would indeed be zero seconds is to consider the analog equivalent of a bandpass resonator with pure inductors and capacitors (L and C in parallel to ground, or optionally L and C in series between input and output). At resonance (and only at resonance) X_L exactly cancels X_C so we are left with the equivalent of a zero-length wire (omitting the reality of the physical distance between input and output). So to the extent we would say the time delay of a short wire would be 0 seconds, so too would be the resonator when the frequency is right at resonance.

The importance of not confusing "Time Delay" with "Group Delay" and how they are different are demonstrate in examples where the Group Delay is negative yet the system is still causal as in this graphic I have below using the transfer function $H(z)=\frac{42.7(z-0.9)^2}{(z-0.1)^2}$ with a pulse modulated carrier at 0.1 radians/sample:

To post reply to a comment, click on the 'reply' button attached to each comment. To post a new comment (not a reply to a comment) check out the 'Write a Comment' tab at the top of the comments.

Please login (on the right) if you already have an account on this platform.

Otherwise, please use this form to register (free) an join one of the largest online community for Electrical/Embedded/DSP/FPGA/ML engineers: