Author Topic: Difference between phase response and group delay  (Read 7865 times)

0 Members and 1 Guest are viewing this topic.

Offline fonographTopic starter

  • Frequent Contributor
  • **
  • Posts: 369
  • Country: at
Difference between phase response and group delay
« on: October 08, 2017, 03:42:36 am »
This is something I am trying to understand for over a year.I watched bunch of videos,googled everything,read quora,wikipedia and bunch of articles yet I still have zero idea what group delay is.Every time I read about it,it sounds and looks exactly like phase response,I dont know what to do anymore,help me please :'(

Phase response also called phase shift or phase delay,thats easy for me to understand.If there is signal where two sinewaves of different frequency and they both start and stop at same time,after they go through filter with phase shift,one will start and stop later,it will be delayed,its nothing more than delay with different delay times at different frequencies.

Now what the hell is group delay?! It also shows delay vs frequency plot,but thats exactly what phase response looks like,it also sounds to me like same thing,delay vs frequency and delay vs frequency,how on earth can these be different?! It looks and sounds exactly same! What is this group stuff anyhow,any signal in existance can be deconstructed to sineways of different phase and amplitude,so what is this group thing then?

Wikipedia says something about amplitude envelope,but there is no such fundamental thing as amplitude envelope,every amplitude envelope is just result of sinewave of different frequencies,amplitudes and phases,maybe I am dumb but I dont see how amplitude envelope can be any different than as predicted by the frequency and phase response of filter,phase and amplite vs frequency graph is all thats needed to fully charcterize filter,or is it not?


« Last Edit: October 08, 2017, 03:46:18 am by fonograph »
 

Offline bson

  • Supporter
  • ****
  • Posts: 2265
  • Country: us
Re: Difference between phase response and group delay
« Reply #1 on: October 08, 2017, 05:21:24 am »
It's \$d\phi/d\omega\$.  The phase \$\phi\$ is in rad and the frequency \$\omega\$ is in rad/s.  rad/(rad/s) = s.  More specifically, it's the slope of the phase line in a Bode plot; if it's a straight line, then the group delay is constant (the slope is the same, regardless of frequency) and the phase response is said to be linear.  If it's not linear, then a signal consisting of purely a voltage, like logic, will have some of its frequencies skewed - typically higher frequency voltage changes will lag more, but anything is possible.  For audio it means a wide-spectrum waveform like from a percussion instrument will be spread out in time, making it more diffuse.  In general, group delay is not considered distortion since there are no spurious frequency products, and requires a VNA to measure.  A common way to look for group delay is to feed a square wave through a filter or circuit, and see if it still looks like a square wave coming out, but there are many other reasons it might not and the only way to know is to examine the phase response.  The phase response is the curve \$\phi(\omega)\$; group delay is the slope of the phase curve.
« Last Edit: October 08, 2017, 05:26:55 am by bson »
 
The following users thanked this post: kg4arn

Offline orolo

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: es
Re: Difference between phase response and group delay
« Reply #2 on: October 08, 2017, 06:05:53 pm »
Note that the definition of group delay is a derivative with respect to frequency. This means that group delay is defined as a local propierty respect to frequency, or if you will, a propierty that makes sense for waves with a narrow spectrum.

Set a fixed angular frequency \$\omega_0\$. The fact that, at that frequency, group delay is \$k\$, means that \$\left.\frac{\mathrm{d}\phi}{\mathrm{d}\omega}\right\vert_{\omega_0} \ = \ k\$. By the definition of derivative, the phase shift near the central frequency is: \$\phi(\omega_0 + \Delta\omega) \ = \ \phi(\omega_0) + k\cdot \Delta\omega\$. Of course, this is very accurate as long as you don't go too far away from the central frequency.

Imagine a wave with a very narrow spectrum, between \$\omega_0 - \epsilon\$ and \$\omega_0 + \epsilon\$, for epsilon a relatively small number. The Fourier transform of the wave is:

\$\displaystyle \psi(t) \ = \ \int_{\omega_0-\epsilon}^{\omega_0+\epsilon}\, a(\omega) e^{-it\omega}\, d\omega\$

Let us change the variables to \$\Delta\omega = \omega-\omega_0\$

\$\psi(t) \ = \ \displaystyle \int_{-\epsilon}^{\epsilon}\, a(\Delta\omega) e^{-it\omega_0-it\Delta\omega}\, d\Delta\omega \quad = \quad e^{-it\omega_0}\,  \int_{-\epsilon}^{\epsilon}\, a(\Delta\omega)\, e^{-it\Delta\omega} d\Delta\omega\$

As you can see, the wave is a small modification of a sinusoidal wave. Now, if you pass the wave through the filter, if the group delay equals \$k\$, we are phase shifting the wave by \$\phi(\Delta\omega) = \phi(0) + k\Delta\omega\$ (see the definition of derivative above).

So the Fourier component of the filtered wave, let us call it \$\tilde{\psi}\$, will be:

\$\displaystyle \tilde{\psi}(t) \ = \ e^{-it\omega_0}\,  \int_{-\epsilon}^{\epsilon}\, a(\Delta\omega)\,e^{i\phi(0) + ik\Delta\omega}\, e^{-it\Delta\omega} d\Delta\omega \ = \   e^{-i\omega_0(t - \phi(0)/\omega_0)}\,  \int_{-\epsilon}^{\epsilon}\, a(\Delta\omega) e^{-i(t-k)\Delta\omega}  d\Delta\omega \$

Note the last integral:

1. The fundamental, \$\omega_0\$ component of the wave has been shifted by the phase delay \$\phi(0)/\omega_0\$.

2. The narrow spectral components have been shifted by \$k\$, the group delay.

I think here you can see the difference between phase and group delay. The phase delay affects the carrier wave, while the group delay affects the modulation of that wave, so to speak. It is an effect in the neighbourhood of the central frequency.

Now on to review all the LaTeX errors. Editions to follow  :P.
« Last Edit: October 08, 2017, 08:33:29 pm by orolo »
 

Offline fonographTopic starter

  • Frequent Contributor
  • **
  • Posts: 369
  • Country: at
Re: Difference between phase response and group delay
« Reply #3 on: October 08, 2017, 10:42:47 pm »
bson orolo  I dont understand equations,can you explain it in intuitive simple way?

Is group depay and phase response really a same thing,its just one is measured in degrees and other in time units?

Frequency specific group delay will always cause  frequency specific delay and phase shift
Frequency specific phase shift will always cause frequency specific delay and phase shift

group delay = delay and phase shift
phase shift = delay and phase shift

For example if you have group delay 1 second at 100hz,its a same exact thing as phase shift of 36000 degrees at 100hz.
Carrier wave and modulation of that carrier wave are all just sinewaves! There arent any magic sinewaves that are intrinsicaly carriers and others who are intrinsicaly modulators,its just sines! Phase shift at specific frequency doesnt care if its carrier,sideband or 35th harmonic of mongol throat singer recorded through microphone,every signal is just bunch of sines with different frequency,amplitude and phase.

I cannot possibly imagine how filter looks at bunch of sines going through it and decide which are carrier so it will apply phase shift and which ones are sidebands so it applies group delay to the modulation.
« Last Edit: October 08, 2017, 10:54:17 pm by fonograph »
 

Offline orolo

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: es
Re: Difference between phase response and group delay
« Reply #4 on: October 08, 2017, 11:08:17 pm »
I'm not good at metaphors, and I believe that in science they make very poor substitutes for mathematical fact, but I'll try.

You might argue that velocity is a confusing concept. If you know the position of a body at every moment, why would you need velocity? Well, think about what the concept of velocity gives you: how the position of the body changes very soon after, and before, the time you measured that velocity. Relative to the position of the body at the time of measurement. Velocity gives you local (in terms of time and position) information about the movement of the body.

Now change: position -> phase, time -> frequency, velocity -> group delay, time of measurement -> carrier frequency, small change of time -> modulation / narrow frequency.

You might argue that group delay is a confusing concept. If you know the phase delay of the signal at every frequency, why would you need group delay? Well, think about what the concept of group delay gives you: how the phase of the signal changes very near the frequency you measured that group delay. Relative to the phase of the signal at the frequency of measurement. Group delay gives you local (in terms of frequency and phase) information about the phase change of the signal.
« Last Edit: October 09, 2017, 01:41:02 am by orolo »
 

Online vk6zgo

  • Super Contributor
  • ***
  • Posts: 7563
  • Country: au
Re: Difference between phase response and group delay
« Reply #5 on: October 09, 2017, 05:22:10 am »
This is something I am trying to understand for over a year.I watched bunch of videos,googled everything,read quora,wikipedia and bunch of articles yet I still have zero idea what group delay is.Every time I read about it,it sounds and looks exactly like phase response,I dont know what to do anymore,help me please :'(

Phase response also called phase shift or phase delay,thats easy for me to understand.If there is signal where two sinewaves of different frequency and they both start and stop at same time,after they go through filter with phase shift,one will start and stop later,it will be delayed,its nothing more than delay with different delay times at different frequencies.

Now what the hell is group delay?! It also shows delay vs frequency plot,but thats exactly what phase response looks like,it also sounds to me like same thing,delay vs frequency and delay vs frequency,how on earth can these be different?! It looks and sounds exactly same! What is this group stuff anyhow,any signal in existance can be deconstructed to sineways of different phase and amplitude,so what is this group thing then?

Wikipedia says something about amplitude envelope,but there is no such fundamental thing as amplitude envelope,every amplitude envelope is just result of sinewave of different frequencies,amplitudes and phases,maybe I am dumb but I dont see how amplitude envelope can be any different than as predicted by the frequency and phase response of filter,phase and amplite vs frequency graph is all thats needed to fully charcterize filter,or is it not?

I think the " amplitude envelope" comment may come from the Group Delay test sets which were used back in the day.

From memory, they displayed the Group Delay in the form of a modulation envelope.
This type of display was to make it easy to read off a 'scope screen.
The same display technique was used for various other types of tests.
 

Offline orolo

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: es
Re: Difference between phase response and group delay
« Reply #6 on: October 09, 2017, 07:12:09 pm »
To illustrate qualitatively how phase and group delay work, one cannot use a single sinewave, since it's unaffected by group delay. So let us consider the following wave (let us forget about the difference between frequency and angular velocity to avoid all the multiples of Pi):

\$\phi \ = \ \sin(50\cdot t) \left(\cos(t) + \cos(2\cdot t)\right)\$

This is a 50Hz sinewave, modulated by 1Hz and 2Hz signals. Its spectrum has peaks at 48, 49, 50, 51 and 52 Hz. So the spectrum of this wave is clustered about 50Hz.

If we picture this wave, we get a slowly modulated fast carrier:



Now we will pass this wave trough three filters: one only with phase delay, the second with only group delay, and the third with variable group delay (group acceleration). I hope this helps to make the matter more clear. By the way, there is a problem with my gif driver, so the quality of the animations is regrettably low. I had to overdimension them to keep some detail. Sorry for the inconvenience.

First filter: This filter applies a fixed phase delay to 50Hz, but with zero group delay near 50Hz.

Instead of picturing the output wave, we will picture an animation of the wave undergoind the delay. At the beginning it's our initial wave, and at the end is the filtered wave. Here it is:



To better appreciate the details, here is a close up:



Since the phase delay is equal for all frequencies, the envelope of the wave remains constant, while the carrier is being phase shifted. If we were demodulating the wave, we wouldn't know the filter is there.

This example of filter is a bit unrealistic: the modulated frequencies should be closer to 50Hz for a filter like this to work.

Second filter: This filter has a phase shift of zero at 50Hz, but a constant group delay. This means that, the more one sine component deviates from 50Hz, the more it is phase shifted. Once again, instead of picturing the output wave, we animate from the incoming wave to the filtered wave, as if the filtering was gradual:



Here it can be seen that the envelope is moving while the carrier is behaving as an stationary wave (no phase shift). A close up like the previous one:



If we were demodulating the wave, we would experience a delay in the filtered signal.

Third filter: Let's see what happens if we have a filter with zero phase shift at 50Hz, but with increasing group delay as we move away in frequency from 50Hz? Here we have a filter with constant group delay acceleration:



In this case, the different modulating components move about at different velocities, and the envelope is distorted. We have dispersion in the modulated spectrum. The carrier remains a stationary wave, though (no close up; too many pics already).

I hope this helps make this a little more clear. Again, sorry for the low res of the pictures.
« Last Edit: October 09, 2017, 07:23:07 pm by orolo »
 
The following users thanked this post: ivaylo, mathsquid, albert22, Muxr, modmix, fonograph

Offline IconicPCB

  • Super Contributor
  • ***
  • Posts: 1527
  • Country: au
Re: Difference between phase response and group delay
« Reply #7 on: October 10, 2017, 12:54:48 pm »
A clear example used to be image smear on a colour TV set.

In the old analogue TV transmission the image consisted of luminance ( black and white part of image) and chrominance the coloured  content of image.

In case of bad group delay performance ( say in cable TV setup) you would end up with annoying colour smear at edges of displayed objects on the screen.
This was due to the fact that higher frequency components of video signal arrived at different time to the black and white parts of video signal ) and when decoded and displayed the time difference ( group delay) resulted in inferior screen image.
 

Online vk6zgo

  • Super Contributor
  • ***
  • Posts: 7563
  • Country: au
Re: Difference between phase response and group delay
« Reply #8 on: October 11, 2017, 01:28:32 am »
A clear example used to be image smear on a colour TV set.
In the old analogue TV transmission the image consisted of luminance ( black and white part of image) and chrominance the coloured  content of image.

In case of bad group delay performance ( say in cable TV setup) you would end up with annoying colour smear at edges of displayed objects on the screen.
This was due to the fact that higher frequency components of video signal arrived at different time to the black and white parts of video signal ) and when decoded and displayed the time difference ( group delay) resulted in inferior screen image.

Well, I have to differ here,---the black & white parts (Luma) of the video signal extend out to the full bandwidth of the video signal.(5MHz in the PAL system used in Oz)
The Luma signal is where you get all your horizontal resolution.

The Chroma signal bandwidth, by comparison, is around 1.07MHz, with its carrier sitting at approx4.433MHz.
There is minimal energy in the Luma signal between harmonics of line rate, so the Chroma side bands are
"slotted in" between them in a technique sometimes called "frequency interlace".

Early colour receivers used simple LP filters, so rolled off the Luma response above 3MHz or so, giving rise to the incorrect idea that "it's all Chroma above 3MHz".
"Early adopters" gained colour but lost resolution!

Later Receiver designs utilised comb filters, which allowed the full Luma resolution to be realised.


 

Offline IanMacdonald

  • Frequent Contributor
  • **
  • Posts: 943
  • Country: gb
    • IWR Consultancy
Re: Difference between phase response and group delay
« Reply #9 on: October 11, 2017, 06:57:48 am »
NTSC was sensitive to phase changes in the signal path causing hue shifts. PAL overcame that by doing a two-line comparison of chroma, using a delay line. 

NTSC: Never Twice the Same Color.  :P  (American spelling appropriate here)
 

Offline IconicPCB

  • Super Contributor
  • ***
  • Posts: 1527
  • Country: au
Re: Difference between phase response and group delay
« Reply #10 on: October 11, 2017, 10:14:38 am »
VK6,

I appreciate Your comment and have no problems with it however it under normal circumstance. It is not applicable in case of a cable TV set up ( CATV/MATV ) since excessive group delay through the cable does in fact result in delay between Chrominance signal and luminance signal resulting in a colour dsiplacement on screen.
I also appreciate the NTSC/PAL/SECAM advantages and shortcomings. PAL will correct  colour but will not correct for group delay through the transmission line.
The only practical solution is an all pass network with minimal insertion loss correcting for group delay inequality in the cable at the particular band.


The human eye is good for about 0.5% distortion ( -47dB ) before it finds image objectionable Unfortunately due to old age and lack of use ( last accessed during early eighties) , I can not recall the exact specification on group delay ( nano seconds ) inequality across the channel width before the eye complains.
I shall try to dig this information up for sake of completeness of argument.
 

Offline aandrew

  • Frequent Contributor
  • **
  • Posts: 277
  • Country: ca
Re: Difference between phase response and group delay
« Reply #11 on: October 13, 2017, 12:07:24 am »
Orolo, how are you generating those images? Nice mathml too, tell us your secret!
 

Offline IconicPCB

  • Super Contributor
  • ***
  • Posts: 1527
  • Country: au
Re: Difference between phase response and group delay
« Reply #12 on: October 13, 2017, 07:49:04 am »
A quick search points to group delay inequality within a channel of 75nS ( another source suggests 170 although i think 75 is probably more appropriate).

This group delay inequality will result in on screen displacement between chrominance and luminance content.
I think it is fairly straight forward to calculate the number of lines of horisontal scan per second and calculate the DURATION of one horisontal line.

The line duration places the 75nano seconds in perspective in terms of percentage displacement of chrominance and luminance in the line and therefore a feel for objectionable distortion on screen.

I hope this clarifies the example quoted.
 

Offline orolo

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: es
Re: Difference between phase response and group delay
« Reply #13 on: October 13, 2017, 08:06:11 am »
Orolo, how are you generating those images?
With a wonderful package from your country, Maple. There are some extremely talented mathematicians developing it; we used Mathematica at college but, after discovering Maple, I switched and never looked back. Regrettably, my version is a bit old and win10 seems to dislike it.

Quote
Nice mathml too, tell us your secret!
It's \$\LaTeX\$! I can't thank enough the guys who developed the LaTeX add-on for blogs and forums, it's easy to use and a game changer. But I understand that abusing it can come off as pedantic or annoy people who don't like math that much.
 

Offline fonographTopic starter

  • Frequent Contributor
  • **
  • Posts: 369
  • Country: at
Re: Difference between phase response and group delay
« Reply #14 on: October 15, 2017, 03:57:04 pm »
I want to say (type) big THANK YOU to Orolo for extensive effort to explain it to me,such thing is rare occurence and I want to express my gratitude.

I still dont understand  :-[  If you still have patience,I have idea how you can explain it to me.I will need two 2D pictures,horizontal axis is time,vertical frequency,like a spectrogram,and show three sinewaves with start and end points before and after going frequency specific group delay filter and phase shifting filter for comparsion for example,each sinewave cycle is split into 4 parts,each part represents 1 quarter of cycle,250 milisecond delay of 1hz sinewave would look like one character shift.




100hz                    123412341234123412341234123412341234 

50hz                      1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3

25hz                      1   2   3   4   1   2   3   4   1   2   3   4   1   2


   
a 180 degree phase shift at 50hz would look like this


100hz                    123412341234123412341234123412341234 

50hz                          1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3

25hz                      1   2   3   4   1   2   3   4   1   2   3   4   1   2


or is that how 50milisecond group delay at 50hz would look like? I am not sure.If you could manage to show me this way how the relative position and phase changes that I think would finaly allow me to understand it.


                           
               
 

 
« Last Edit: October 15, 2017, 04:00:34 pm by fonograph »
 

Offline orolo

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: es
Re: Difference between phase response and group delay
« Reply #15 on: October 15, 2017, 07:37:26 pm »
I'm not sure about how to do that spectrograph. I can plot one, but since we are phaseshifting, the frequencies of the waves won't change, so the spectrogram will be flat.  Maybe a phase vs time graph?

Anyway, I believe your idea of thinking about specific frequencies is okay, and you don't need to overcomplicate things. I'll try to explain again, using a different argument. The explanation should be split in two parts: first, meaning of phase vs group delay. Second, how do you interpret that intuitively. Some heavy graphs to come: this time I'm doing them in python and including source at the ending.

First: phase shift versus group delay.

Having a filter with phase shift of 1 rad at 50Hz means that a pure 50Hz wave passing through that filter will experience a phase shift of 1 radian. Note that this says absolutely nothing about what happens at other frequencies: this filter could have arbitrary phase shifts at 51Hz, 100Hz, or 17Hz.

Group delay is a derivative: the ratio of phase shift relative to frequency. Instead of seconds, think that group delay is measured in radians per Hz, rad/Hz. If you have a group delay of 1 rad/Hz at 50Hz, that means that at 51Hz you will have 1 more radian of phase shift than at 50Hz. At 52Hz you will have 2 rads more than at 50Hz. And at 49Hz you will have 1 rad less of phase shift than at 50Hz. Group delay tells you how phase shift changes when you deviate from the frequency where you measure it.

Joining both concepts: if you have a phase shift of 2 radians at 50Hz and a group delay of 3 rad/Hz, that means phase shifts of: 2 rad @ 50Hz, 5rad @ 51Hz, 8rad @ 52Hz, -1 rad @ 49Hz, -4 rad @ 48 Hz, etc.

It is important to note the following: if you have a filter with zero phase shift at 50Hz, and with 100 rad/Hz group delay at 50Hz. If you pass a pure 50Hz wave through that filter, the wave will be... unaltered. A 51Hz sinewave would be shifted 100rads, and a 49Hz one -100rads, but the 50Hz wave is unaltered.

So, phase shift gives you the phase at an specific frequency. If you also know group delay, it gives you the phase shift at nearby frequencies.

Note that group delay, by itself, is not enough to determine phase shift. You need the phase shift at a given frequency for reference. So, if you only know group delay, even if you ignore phase shift, what does that mean? This is for part 2.

Second: Intuitive meaning of group delay.

The idea that group delay is how the "envelope" of a carrier wave is phase shifted, while the carrier remains unaltered, is correct. Let us try to visualize that. By carrier wave we mean the pure frequency at which you measure the group delay. By envelope we mean the nearby frequencies, that will experience different phase shifts the farther they are from the carrier (because that's what group delay means, more away in frequency, more phase deviation).

Imagine that you have a pure 10Hz wave (not 50Hz anymore, in the graphs lower frequencies look clearer). Let us create a waveform that has an "envelope" at 10Hz. The easiest way is the following: we get a 10Hz wave and multiply it by a 1Hz wave. The result is a 10Hz wave "filling up" the shape of the 1Hz wave.



This product wave we have obtained is not a simple sinewave, so it's natural to ask ourselves what's its spectrum. Here high school trigonometry comes in our help. Let's see, a 10Hz (forget the pi's!) sinewave is \$\cos(10 t)\$ and a 1Hz sinewave is \$\cos(t)\$. So the product wave is \$\cos(10t)\cos(t)\$.

Remember the cosine addition laws? \$\cos(a+b) = \cos a\cos b - \sin a\sin b\$ and \$\cos(a-b) = \cos a\cos b + \sin a\sin b\$. If you add both relations, you obtain:

\$\cos(a+b) + \cos(a-b) \ = \ 2\cos a\cos b\$

What is relevant of this relation is that it turns a product of cosines into a sum of pure cosines. If you make a=10t, b=t, you get:

\$\cos(11t) + \cos(9t) \ = \ 2\cos 10t\cos t\$

In other words, the spectrum of our product wave has components at 9Hz and 11Hz, and none at 10Hz. Let us check that:



Notice that the added wave goes from -2 to 2? It's that pesky factor of two in the cosine law. Let's compare the product and addition waves to be sure:



Okay, they match (save for the 2x factor). Now we are ready to understand why group delay operates on envelopes. Notice:

-> Since our waveform has no fourier component at 10Hz, it is unaffected by any phase shift at 10Hz.
-> Since out waveform has fourier components near 10Hz, it is affected by group delay at 10Hz.

Okay, our waveform is affected by group delay. But affected, how?

Imagine we have a filter with no phase shift at 10Hz, but with group delay of 1 rad/Hz. This means that the component of our waveform at 9Hz will be shifted by -1rad, and the component at 11Hz will be shifted by 1rad. Remember the cosine law? If we write it in reverse:

\$\cos a + \cos b \ = \ 2\cos\frac{a+b}{2}\cos\frac{a-b}{2}\$

\$\cos(11t+1) + \cos(9t - 1) \ = 2\ cos\frac{11t+1+9t-1}{2}\cos\frac{11t+1-9t+1}{2} \ = \ 2\cos 10t \cos(t+1) \$

The 10Hz "carrier" part is unaltered, while the 1Hz "envelope" part is shifted by 1 radian! This is what group delay does to nearby frequencies: it coherently phase shifts them with respect to the center frequency.

Below there are graphics for the 1 rad/Hz delay, and also a 2 rad/Hz delay:



There you can see that the carrier is coherently delayed by the given angle: the whole wavepacket is delayed without losing it shape.

As promised, the source code for the images. It requires python with numpy and matplotlib.

Code: [Select]
import numpy as np
import matplotlib.pyplot as plt

t = np.arange(0.0, 5.0, 0.01)
s10 = np.cos(2*np.pi*10*t)
s1 = np.cos(2*np.pi*1*t)
sp = s1*s10

# 1Hz, 10Hz, product.
fig, (sub1, sub2, sub3) = plt.subplots(nrows=3)
sub1.set_title("1Hz sinewave")
sub2.set_title("10Hz sinewave")
sub3.set_title("Product sinewave  (1Hz * 10Hz)")
sub1.plot(t, s1)
sub2.plot(t, s10)
sub3.plot(t, sp)
plt.tight_layout()
plt.show()

# 9Hz, 11Hz, addition.
fig, (sub1, sub2, sub3) = plt.subplots(nrows=3)
s9 = np.cos(2*np.pi*9*t)
s11 = np.cos(2*np.pi*11*t)
sadd = s9 + s11
sub1.set_title("9Hz sinewave")
sub2.set_title("11Hz sinewave")
sub3.set_title("Added sinewaves (9Hz + 11Hz)")
sub1.plot(t, s9)
sub2.plot(t, s11)
sub3.plot(t, sadd)
plt.tight_layout()
plt.show()

# Comparison.
fig, (sub1, sub2) = plt.subplots(nrows=2)
sub1.set_title("Product sinewave  (1Hz * 10Hz)")
sub2.set_title("Added sinewaves (9Hz + 11Hz)")
sub1.plot(t, sp)
sub2.plot(t, sadd)
plt.tight_layout()
plt.show()

# Apply 1 rad/Hz [s] and 2 rad/Hz group delays.
fig, (sub1, sub2, sub3) = plt.subplots(nrows=3)
sub1.set_title("Normal wave (9Hz + 11Hz)")
sub2.set_title("1 rad/Hz delayed wave")
sub3.set_title("2 rad/Hz delayed wave")
sub1.plot(t, sadd)
sdel1 = np.cos(2*np.pi*9*t-1) + np.cos(2*np.pi*11*t+1)
sub2.plot(t, sdel1)
sdel2 = np.cos(2*np.pi*9*t-2) + np.cos(2*np.pi*11*t+2)
sub3.plot(t, sdel2)
plt.tight_layout()
plt.show()
« Last Edit: October 15, 2017, 08:04:12 pm by orolo »
 
The following users thanked this post: albert22, The Soulman, fonograph, mriver

Offline albert22

  • Regular Contributor
  • *
  • Posts: 177
Re: Difference between phase response and group delay
« Reply #16 on: October 18, 2017, 09:00:12 pm »
Orolo, Buenisimas tus explicaciones.
Muchas gracias. Un abrazo
 
The following users thanked this post: orolo

Offline The Soulman

  • Frequent Contributor
  • **
  • Posts: 949
  • Country: nl
  • The sky is the limit!
Re: Difference between phase response and group delay
« Reply #17 on: October 18, 2017, 09:52:46 pm »
Now do Impulse response.  :P
 

Offline orolo

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: es
Re: Difference between phase response and group delay
« Reply #18 on: October 19, 2017, 12:14:55 am »
Now do Impulse response.  :P
Hm, let me try a quick answer, no time for graph heavy stuff just now.

Think of a bell or a tuning fork. How do people make these systems oscillate? After some heavy readings on amplifiers and feedback, one may think: by connecting the bell to an amplifier and then feeding back the signal a multiple of 360 degrees out of phase. Well, that's one way ringing a bell, but not the usual way. People excite bells and tuning forks kicking the hell out of them.

Why does a kick excite any resonant system? A kick is a very brief, very strong pulse of energy transmitted to the system. If we were to formalize it in mathematical terms, we could think of a very narrow, very tall square pulse. In the ideal limit this would be an infinitesimally narrow pulse of infinite intensity, a function (really something more general, a distribution) called Dirac's Delta.

As the bells and tuning forks experiences suggest, the spectrum of a Dirac Delta is constant in all frequencies. This is the reason why this impulse is able to couple to any resonant system, no matter its frequency. An impulse response analysis consists of inputting a Dirac Delta to a system, and then watching the output of the system in the time domain.

So analyzing impulse response is the math heavy equivalent to the ages old trick of hitting a machine with a monkey wrench and then listening. Since the hit is perfectly localized in time and uniform in all frequencies, the resulting sound will be very characteristic of the system you are clobbering. The resonances of the system will be very present in the response, while the attenuated frequencies will be absent. The spectrum of the generated sound will be a perfect representation of the frequency response of the system.

This is, in a few words and with no math, the meaning of impulse response analysis. Hit the system with a Dirac Delta, compute the spectrum of the output, and you have the whole frequency response of the system.

For the impulse response to be characteristic, the system must be linear and time independent. If it is time dependent, the response will change depending on when you kick the system. If it is nonlinear, the excited frequencies will get mixed, and you won't be probably capable of tracing back the origin of the excitations from the spectrum of the response.
 
The following users thanked this post: hamster_nz

Offline fonographTopic starter

  • Frequent Contributor
  • **
  • Posts: 369
  • Country: at
Re: Difference between phase response and group delay
« Reply #19 on: October 22, 2017, 06:27:24 pm »
"""Group delay is a derivative: the ratio of phase shift relative to frequency. Instead of seconds, think that group delay is measured in radians per Hz"""

Does this mean phase shift and group delay is same thing except one is rated in degrees and other is rated in time units like seconds?

Everything you tried so far to explain what group delay is,it always sounds like phase shift to me.A 1 second group delay at 1Hz is from my point od view the exact same thing as phase shift of 360 degrees,that means one full cycle delay,that means 1 second at 1Hz that means its exactly same thing
« Last Edit: October 22, 2017, 06:29:23 pm by fonograph »
 

Offline IconicPCB

  • Super Contributor
  • ***
  • Posts: 1527
  • Country: au
Re: Difference between phase response and group delay
« Reply #20 on: October 22, 2017, 09:47:48 pm »
since spped of light varies with refractive index, it is not unreasonable to expect a wave front become retarded ( delayed as it travels through a medium.) IF the refractive index is wavelength sensitive , you would see different coloured content of an image separate into various colour groupings as it traveled through such a medium. This colour separation would result in a smeared image over time.

So it is with electronic medium where a group delay inequality exists across the frequency band of interest. The signal enter such a medium and then as it traverses the medium ( circuit ) it separates various frequency components according to group delay characteristics of the medium and deliveres them so separated to the output of the circuit. The delay imparted various frequency components will result in a skewing and smearing of the electronic signal.

delay is not phase shift in this instance as it applies to components of a signal ( THINK OF FOURIER TRANSFORM OF A COMPLEX SIGNAL SHAPE)

 

Offline mriver

  • Newbie
  • Posts: 1
  • Country: au
Re: Difference between phase response and group delay
« Reply #21 on: August 10, 2018, 06:05:52 am »
Sorry for bumping this old thread, but I couldn't help after reading this awesome explanation @Orolo. Can you please also comment on the difference between phase delay (\$ \tau_p \$) and group delay (\$ \tau_g \$) defined as

\$ \tau_p = - \frac{\phi}{\omega} \$

\$ \tau_g = - \frac{d \phi}{d \omega} \$

where \$ \phi \$ is the phase?

What I meant, If I know \$ \tau_p \$ as a function of \$ \omega \$, is there any additional use of \$ \tau_g \$?
« Last Edit: August 10, 2018, 06:18:58 am by mriver »
 

Offline bson

  • Supporter
  • ****
  • Posts: 2265
  • Country: us
Re: Difference between phase response and group delay
« Reply #22 on: August 10, 2018, 09:45:57 pm »
It's \$\LaTeX\$! I can't thank enough the guys who developed the LaTeX add-on for blogs and forums, it's easy to use and a game changer. But I understand that abusing it can come off as pedantic or annoy people who don't like math that much.
Yup, it's LaTeX, but other formats are supported as well.  http://mathjax.org

One problem is while it's easy to add custom JS to forums, blogging software, etc, in the case of this forum software this isn't honored for previews and so mathjax markup can't be previewed.  But there's a live demo at https://www.mathjax.org/#demo which makes it easy to edit a non-trivial expression and then copy it into a post here... I don't trust my off-the-cuff LaTeX skills and tend to have to go through a whole bunch of edits otherwise until I get it right.  |O
 

Offline bson

  • Supporter
  • ****
  • Posts: 2265
  • Country: us
Re: Difference between phase response and group delay
« Reply #23 on: August 10, 2018, 10:01:27 pm »
Sorry for bumping this old thread, but I couldn't help after reading this awesome explanation @Orolo. Can you please also comment on the difference between phase delay (\$ \tau_p \$) and group delay (\$ \tau_g \$) defined as

\$ \tau_p = - \frac{\phi}{\omega} \$

\$ \tau_g = - \frac{d \phi}{d \omega} \$

where \$ \phi \$ is the phase?

What I meant, If I know \$ \tau_p \$ as a function of \$ \omega \$, is there any additional use of \$ \tau_g \$?
Phase delay is an absolute measurement; group delay is the curve slope.  It just so happens that the latter resolves to a unit of second (angle/frequency, where freq=angle/s), but don't let this deceive you; they measure two different things.
 

Online G0HZU

  • Super Contributor
  • ***
  • Posts: 3012
  • Country: gb
Re: Difference between phase response and group delay
« Reply #24 on: August 10, 2018, 11:36:46 pm »
A simple way to understand group delay is to think of it as the rate of change of phase with respect to frequency.

If designing an oscillator it is often a design aim to go for highest loaded Q in the resonator (at zero degrees around the loop). This should give low phase noise and good stability. Another way to describe the same aim is to go for the highest 'group delay' in the resonator (at zero degrees around the loop). This might sound crazy at first, but if you think of group delay as 'rate of change of phase wrt frequency' then it makes total sense that you want to design for a steep phase slope (so you get good stability and low phase noise) and a steep phase response wrt frequency is the same as asking for high group delay.

Some VNAs have a DELAY function and this is usually just calculating (and displaying) group delay based on the phase vs frequency response.

So if you were looking at the open loop bode plot (gain and phase) of an oscillator on a VNA, it is much easier to also look at group delay to see where the slope of the phase is at its greatest. This is also where you want the zero phase point to be and you also want greater than unity gain around the loop to ensure oscillation will take place when the loop is closed after the open loop test. The alternative is to try and look at the phase response and see where it is steepest but this is very hard to do! It's like trying to find the very steepest part of the slope in a Z character that has some subtle wobbles in the slope shape. This can be hard to do quickly by eye but the group delay function in the VNA does it for you!

Note that if you measure group delay with a VNA and look through a classic parallel LC trap circuit you will see negative group delay in (nano)seconds. This obviously doesn't mean the signal arrives at port 2 before it leaves port 1 on the VNA. It just means that the phase vs frequency slope is flipped near the notch frequency. So you get a negative slope and so you see negative group delay on the VNA.

See the plot below for the open loop response of an oscillator. It shows the gain and phase and group delay plot. It also show loaded Q. The green trace is 'group delay' and you can see how much easier it is to see where the steepest part of the blue phase response is. It is at the peak of the green group delay plot.

See also the phase noise response of this oscillator after it was built and tested. Because the loaded Q is high (or in other words, the group delay is high) at the zero phase point in the loop the phase noise should be low and the plot proves this.

« Last Edit: August 11, 2018, 12:02:31 am by G0HZU »
 
The following users thanked this post: fonograph


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf