What is positive phase shift in filters?

Z1202
 KVRian
 1072 posts since 12 Apr, 2002
What is positive phase shift in filters?
This question was probably addressed multiple times before, but somehow today I for the first time seriously tried to answer it for myself, and FWIW I'm sharing my reasoning.
At the first look positive phase shift seems to be like looking into the future. So have we been missing a time machine which was around all this time? To answer this question let's consider the equality:
a sin( x  pi/4 ) + a sin( x + pi/4 ) = sin x
where a = 1/sqrt(2)
It follows that
sin x  a sin(x  pi/4) = a sin(x + pi/4)
Now notice that this is exactly what's going on in an analog 1pole filter. If x = wt and w is the filter cutoff (the input signal of the filter is a sinusoid of the cutoff frequency), then
input = sin x
LP = a sin(x  pi/4)
HP = input  HP = a sin( x + pi/4)
Also (e.g. from pic.2.13 of this) we can notice that HP is physically constructed as inputLP. So the positively phaseshifted HP signal is obtained by subtracting a negatively phaseshifted signal from the original signal. Thus, there is no time travel into the future, but this is rather simply a mathematical property of the sine function.
At the first look positive phase shift seems to be like looking into the future. So have we been missing a time machine which was around all this time? To answer this question let's consider the equality:
a sin( x  pi/4 ) + a sin( x + pi/4 ) = sin x
where a = 1/sqrt(2)
It follows that
sin x  a sin(x  pi/4) = a sin(x + pi/4)
Now notice that this is exactly what's going on in an analog 1pole filter. If x = wt and w is the filter cutoff (the input signal of the filter is a sinusoid of the cutoff frequency), then
input = sin x
LP = a sin(x  pi/4)
HP = input  HP = a sin( x + pi/4)
Also (e.g. from pic.2.13 of this) we can notice that HP is physically constructed as inputLP. So the positively phaseshifted HP signal is obtained by subtracting a negatively phaseshifted signal from the original signal. Thus, there is no time travel into the future, but this is rather simply a mathematical property of the sine function.

mystran
 KVRAF
 5381 posts since 12 Feb, 2006 from Helsinki, Finland
Re: What is positive phase shift in filters?
I feel like most "weirdness" with phaseshifts can be traced back to either the periodicity of phase (ie. one should really unwrap first) or the ambiguity between phaseshift of pi vs. negative magnitude (ie. in some situations you can't have continuous phase unless you allow for negative magnitudes, even though the complex response itself is certainly continuous).
Spherical geometry in general is tends to be annoying, because you never quite know which way to go. At least the 2D case (ie. just one axis to rotate around) is somewhat wellbehaved. If you want to torture your brain with a related problem that is even more annoying, try doing something like spherical cubic (eg. CatmullRom) interpolation with quaternions, where it's hard to even define what the ideal solution should look like (ie. you'll probably end up with different things depending on whether you try to use geometric or algebraic reasoning).
Spherical geometry in general is tends to be annoying, because you never quite know which way to go. At least the 2D case (ie. just one axis to rotate around) is somewhat wellbehaved. If you want to torture your brain with a related problem that is even more annoying, try doing something like spherical cubic (eg. CatmullRom) interpolation with quaternions, where it's hard to even define what the ideal solution should look like (ie. you'll probably end up with different things depending on whether you try to use geometric or algebraic reasoning).
If you'd like Signaldust to return, please ask Katinka Tuisku to resign.

niarn
 KVRist
 30 posts since 22 Jun, 2013
Re: What is positive phase shift in filters?
Hi z1201, This reminds me of negative group delay In fact I think you may find the answer to your question if you read some of the articles that explains negative group delay and there are some good ones out there.
In your VA book you seem to apply trapezoidal integration a lot. Have you done any mindtwisting exercises considering the pole on the unit circle for this case (just as you have with positive phase shifts ). The pole at z=1 imply a nondecaying transient (a DC component). I mean if you input a sine to the trapezoidal integrator you get an output with a DC offset. Have you done any thoughts about this when constructing filter structures by replacing (1/s) with the trapezoidal integrator?
In your VA book you seem to apply trapezoidal integration a lot. Have you done any mindtwisting exercises considering the pole on the unit circle for this case (just as you have with positive phase shifts ). The pole at z=1 imply a nondecaying transient (a DC component). I mean if you input a sine to the trapezoidal integrator you get an output with a DC offset. Have you done any thoughts about this when constructing filter structures by replacing (1/s) with the trapezoidal integrator?

S0lo
 KVRian
 717 posts since 31 Dec, 2008
Re: What is positive phase shift in filters?
Or may be we can say that, we can travel into the future of the delayed present.Z1202 wrote: ↑Tue Oct 08, 2019 12:54 amAlso (e.g. from pic.2.13 of this) we can notice that HP is physically constructed as inputLP. So the positively phaseshifted HP signal is obtained by subtracting a negatively phaseshifted signal from the original signal. Thus, there is no time travel into the future, but this is rather simply a mathematical property of the sine function.
Last edited by S0lo on Wed Oct 09, 2019 9:26 am, edited 1 time in total.

Z1202
 KVRian
 1072 posts since 12 Apr, 2002
Re: What is positive phase shift in filters?
Negative group delay is about growing phase, whereas I'm talking about the phase being positive but normally still decaying. So while both might give an idea of a time travel possibility, they are not exactly the same
Why does this require any special thought? It's no different from the analog case. Some argument about this has been done in sec 2.3 of the book. A more detailed explanation is given in the discussion of transient responses (which is scattered around different chapters of the book).niarn wrote: ↑Wed Oct 09, 2019 12:32 amIn your VA book you seem to apply trapezoidal integration a lot. Have you done any mindtwisting exercises considering the pole on the unit circle for this case (just as you have with positive phase shifts ). The pole at z=1 imply a nondecaying transient (a DC component). I mean if you input a sine to the trapezoidal integrator you get an output with a DC offset. Have you done any thoughts about this when constructing filter structures by replacing (1/s) with the trapezoidal integrator?

Skupje
 KVRist
 495 posts since 26 Oct, 2018
Re: What is positive phase shift in filters?
The resulting highpass is not positively phase shifted, it's phase shifted in the other direction "towards the stopband".

Z1202
 KVRian
 1072 posts since 12 Apr, 2002
Re: What is positive phase shift in filters?

Skupje
 KVRist
 495 posts since 26 Oct, 2018
Re: What is positive phase shift in filters?
So you have liniar arithmetic for subtracting in  lp, which is time invariant. For a highpass filter you can actually solve late, since the impulse is the onset, and nothing requires you to solve before the onset. So a negative phase is allowed, since theres room to solve for it. Which is later.

Z1202
 KVRian
 1072 posts since 12 Apr, 2002
Re: What is positive phase shift in filters?
I'm not sure what you mean by the above, but if you're talking about causality of the HP impulse response, it's not about questioning that. It's about understanding the seeming contradiction between positive phase response and the causality.Skupje wrote: ↑Wed Oct 09, 2019 1:19 pmSo you have liniar arithmetic for subtracting in  lp, which is time invariant. For a highpass filter you can actually solve late, since the impulse is the onset, and nothing requires you to solve before the onset. So a negative phase is allowed, since theres room to solve for it. Which is later.

niarn
 KVRist
 30 posts since 22 Jun, 2013
Re: What is positive phase shift in filters?
Hi z1202. Just thinking out loud. The positive phase is the response to a sine that extends to infinity in both directions. I mean if the input is x[n]=sin(w n) then it does not really matter if the output is
y[n] = H(w)sin(w n + pi/4)
or
y[n] = H(w)sin(w n  7*pi/4)
For a causal (onesided) input x[n]=sin(w n) u[n]
There is a transient period and after the transient has died out it may look as if the output has come out before the input. But your transfer function does not tell you the response in the transient period. So by only looking at the steadystate response it is the relativephase that is important (and that you base conclusion on), such as the quadrature. You can't conclude that the output comes out before the input because the transfer function does not tell you anything about what happens in the transient/initial period.
y[n] = H(w)sin(w n + pi/4)
or
y[n] = H(w)sin(w n  7*pi/4)
For a causal (onesided) input x[n]=sin(w n) u[n]
There is a transient period and after the transient has died out it may look as if the output has come out before the input. But your transfer function does not tell you the response in the transient period. So by only looking at the steadystate response it is the relativephase that is important (and that you base conclusion on), such as the quadrature. You can't conclude that the output comes out before the input because the transfer function does not tell you anything about what happens in the transient/initial period.

Z1202
 KVRian
 1072 posts since 12 Apr, 2002
Re: What is positive phase shift in filters?
Yes, of course. This is somewhat similar argumentation to the negative group delay. However I was wondering if we need to think of the transient response (maybe we have to, after all the LP part is going to have a transient, but maybe we can do without it). Particularly, while representing pi/4 as 7pi/4 is of course correct from all points of view, it feels intuitively wrong, as the phase of the HP part intuitively and continuously goes from 0 in the passband to +pi/2 in the stopband.niarn wrote: ↑Thu Oct 10, 2019 2:57 amHi z1202. Just thinking out loud. The positive phase is the response to a sine that extends to infinity in both directions. I mean if the input is x[n]=sin(w n) then it does not really matter if the output is
y[n] = H(w)sin(w n + pi/4)
or
y[n] = H(w)sin(w n  7*pi/4)
For a causal (onesided) input x[n]=sin(w n) u[n]
There is a transient period and after the transient has died out it may look as if the output has come out before the input. But your transfer function does not tell you the response in the transient period. So by only looking at the steadystate response it is the relativephase that is important (and that you base conclusion on), such as the quadrature. You can't conclude that the output comes out before the input because the transfer function does not tell you anything about what happens in the transient/initial period.

niarn
 KVRist
 30 posts since 22 Jun, 2013
Re: What is positive phase shift in filters?
I made a small example with a firstorder HP with positive phase from DC to nyquist.
If the green curve (steadystate response) and the blue curve (input) are compared e.g. at sample index 0 it does look like output is coming before input indicating a positive phase.
The red curve (complete response) is the sum of the green (broken) and the black curves.If the green curve (steadystate response) and the blue curve (input) are compared e.g. at sample index 0 it does look like output is coming before input indicating a positive phase.
You do not have the required permissions to view the files attached to this post.

Z1202
 KVRian
 1072 posts since 12 Apr, 2002
Re: What is positive phase shift in filters?
Yup. And then the red curve looks as if it gets progressively negatively delayed

niarn
 KVRist
 30 posts since 22 Jun, 2013
Re: What is positive phase shift in filters?

JCJR
 KVRAF
 2782 posts since 17 Apr, 2005 from S.E. TN
Re: What is positive phase shift in filters?
I was tempted to exposit ideas along the lines of niarn, but niarn did it better.
Seems natural though to equate phase shifts with time shifts. Some cases seem to work and other cases not so much.
For example the ear usually "hears" notes that last at least a few wave cycles. Even if a phase advance can't "look into the future" at the notestart, in some cases can "look into the future" enough to maybe timealign a tweeter with a midrange driver or whatever. Even if the "music notes" are only brief 128th note sine wave beeps, then a high pass positive phase shift might move the "body of each packet of wave periods" ahead in time to sufficiently compensate tweeter positional problems, even though the very beginning of each note can't look into the future. Or whatever. Tis easy to get confused.
In the "captain obvious" category: So far as I know the simple causal filters, lowpass, bandpass, highpass, allpass, generally all have the same "slope direction" of phase shift. If plotted on a chart where Y is phase shift and X is frequency: For instance the first order LP typically goes from 0 at DC down toward 90 degrees at high frequencies, and the first order HP typically goes from +90 at DC down toward 0 degrees at high frequencies. Different vertical offsets but the same slope direction.
I gather that we can't reverse the phase slope direction with stable causal filters but dunno much about it. IIRC we could run reversed audio thru the causal filter to get a reversed phase slope direction.
In fact, in my ignorance this caused a woeful misunderstanding only resolved a few years ago. I had read about processes claiming to "undo" the timedelay of previous layers of phase shifting, and I couldn't understand how one could possibly undo several additive layers of "negative slope" phase shift curves, if the only stable causal tools available also have the same direction "negative slope" phase shift curves.
Until someone kindly pointed out that filters such as shelving and peaking filters have "positive bump" or "negative bump" phase shift curves, not the continuous negative slope curve. So it was indeed possible to undo some kinds of "positive bump" phase curves with complementary "negative bump" phase curves, and viceversa. Doh! The light finally shines, however feebly.
Seems natural though to equate phase shifts with time shifts. Some cases seem to work and other cases not so much.
For example the ear usually "hears" notes that last at least a few wave cycles. Even if a phase advance can't "look into the future" at the notestart, in some cases can "look into the future" enough to maybe timealign a tweeter with a midrange driver or whatever. Even if the "music notes" are only brief 128th note sine wave beeps, then a high pass positive phase shift might move the "body of each packet of wave periods" ahead in time to sufficiently compensate tweeter positional problems, even though the very beginning of each note can't look into the future. Or whatever. Tis easy to get confused.
In the "captain obvious" category: So far as I know the simple causal filters, lowpass, bandpass, highpass, allpass, generally all have the same "slope direction" of phase shift. If plotted on a chart where Y is phase shift and X is frequency: For instance the first order LP typically goes from 0 at DC down toward 90 degrees at high frequencies, and the first order HP typically goes from +90 at DC down toward 0 degrees at high frequencies. Different vertical offsets but the same slope direction.
I gather that we can't reverse the phase slope direction with stable causal filters but dunno much about it. IIRC we could run reversed audio thru the causal filter to get a reversed phase slope direction.
In fact, in my ignorance this caused a woeful misunderstanding only resolved a few years ago. I had read about processes claiming to "undo" the timedelay of previous layers of phase shifting, and I couldn't understand how one could possibly undo several additive layers of "negative slope" phase shift curves, if the only stable causal tools available also have the same direction "negative slope" phase shift curves.
Until someone kindly pointed out that filters such as shelving and peaking filters have "positive bump" or "negative bump" phase shift curves, not the continuous negative slope curve. So it was indeed possible to undo some kinds of "positive bump" phase curves with complementary "negative bump" phase curves, and viceversa. Doh! The light finally shines, however feebly.