What is positive phase shift in filters?

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

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 1-pole 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 input-LP. So the positively phase-shifted HP signal is obtained by subtracting a negatively phase-shifted 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.

Post

I feel like most "weirdness" with phase-shifts can be traced back to either the periodicity of phase (ie. one should really unwrap first) or the ambiguity between phase-shift 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 well-behaved. If you want to torture your brain with a related problem that is even more annoying, try doing something like spherical cubic (eg. Catmull-Rom) 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).

Post

Hi z1201, This reminds me of negative group delay :bang: 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 mind-twisting 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 non-decaying 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?

Post

Z1202 wrote: Tue Oct 08, 2019 8:54 amAlso (e.g. from pic.2.13 of this) we can notice that HP is physically constructed as input-LP. So the positively phase-shifted HP signal is obtained by subtracting a negatively phase-shifted 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.
Or may be we can say that, we can travel into the future of the delayed present.
Last edited by S0lo on Wed Oct 09, 2019 5:26 pm, edited 1 time in total.
www.solostuff.net
Advice is heavy. So don’t send it like a mountain.

Post

niarn wrote: Wed Oct 09, 2019 8:32 am Hi z1201, This reminds me of negative group delay :bang: 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.
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 ;)
niarn wrote: Wed Oct 09, 2019 8:32 amIn your VA book you seem to apply trapezoidal integration a lot. Have you done any mind-twisting 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 non-decaying 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?
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).

Post

Z1202 wrote: Tue Oct 08, 2019 8:54 am So the positively phase-shifted HP signal is obtained by subtracting a negatively phase-shifted 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.
The resulting highpass is not positively phase shifted, it's phase shifted in the other direction "towards the stopband".

Post

Skupje wrote: Wed Oct 09, 2019 4:36 pm
Z1202 wrote: Tue Oct 08, 2019 8:54 am So the positively phase-shifted HP signal is obtained by subtracting a negatively phase-shifted 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.
The resulting highpass is not positively phase shifted, it's phase shifted in the other direction "towards the stopband".
arg HP = arg LP + pi/2 > 0 (since 0 >= arg LP > -pi/2)

Post

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.

Post

Skupje wrote: Wed Oct 09, 2019 9:19 pm 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.
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.

Post

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 (one-sided) 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 steady-state response it is the relative-phase 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.

Post

niarn wrote: Thu Oct 10, 2019 10:57 am 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 (one-sided) 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 steady-state response it is the relative-phase 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.
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.

Post

I made a small example with a first-order HP with positive phase from DC to nyquist.
HP.jpg
The red curve (complete response) is the sum of the green (broken) and the black curves.
If the green curve (steady-state 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.

Post

niarn wrote: Thu Oct 10, 2019 1:02 pmIf the green curve (steady-state 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.
Yup. And then the red curve looks as if it gets progressively negatively delayed :D

Post

Z1202 wrote: Thu Oct 10, 2019 1:05 pm
niarn wrote: Thu Oct 10, 2019 1:02 pmIf the green curve (steady-state 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.
Yup. And then the red curve looks as if it gets progressively negatively delayed :D
Yes :)

Post

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 note-start, in some cases can "look into the future" enough to maybe time-align 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 "un-do" the time-delay of previous layers of phase shifting, and I couldn't understand how one could possibly un-do 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 un-do some kinds of "positive bump" phase curves with complementary "negative bump" phase curves, and vice-versa. Doh! The light finally shines, however feebly. :)

Post Reply

Return to “DSP and Plugin Development”