# Trouble with phase shift function

Discussion in 'General Electronics Chat' started by planeguy67, Aug 29, 2015.

1. ### planeguy67 Thread Starter Member

Jan 29, 2015
59
16
This problem is driving me nuts! Please consider the active all-pass filter below.

The corner frequency, Fc, is where the incoming signal will get shifted 90° in phase and is given by:

Fc = 1/(2πRC)
So, using a value of 22kΩ for R and 47nF for C, we get a frequency of 154 Hz. Good so far, right?

Ok, when I reverse the calculation and plug in 154 Hz into the formula for phase shift, I do NOT get 90°!

The phase shift is supposed to be given by:

Φ = -2 arctan(RC/2πF)
But when I use the values for R, C and F above, I get Φ = -0.001208..... This number looks meaningless (Yes, my calculator is set to DEG, not RAD). Any help? Thanks.

2. ### shteii01 AAC Fanatic!

Feb 19, 2010
3,500
511
really? you need filter for 'dat?

3. ### planeguy67 Thread Starter Member

Jan 29, 2015
59
16
You have a better way of shifting the phase?

4. ### shteii01 AAC Fanatic!

Feb 19, 2010
3,500
511
you said it is all pass... if everything passes though... than what are you filtering out?

since you don't filter out anything... there is no pass region, there is no block region, there is no corner frequency that is the border of the two regions...

if i recall correctly time delay in time domain is the phase shift in frequency domain... so... if my recall is correct, you are going about your goal the wrong way. i will have to dig out my textbook and see if i got this right so i be back in a couple of hours.

5. ### planeguy67 Thread Starter Member

Jan 29, 2015
59
16
I am NOT filtering out ANYTHING. It's an ALL-pass filter, meaning ALL frequencies pass through, but their PHASE is shifted relative to their frequency. The corner frequency, as I stated and will repeat here, is the frequency where the phase shift equals 90°. That's it! The filter does nothing else than that. Hence, the term "phase-shifter".

Here is a plot of the transfer function if that helps you understand what it does. In this example, R is 237k and C is .001uF for a corner frequency of 672 Hz. You can see on the plot where that corresponds with a 90° phase shift.

BTW, I never stated my goal, I just want help with the equation.

6. ### AnalogKid Distinguished Member

Aug 1, 2013
4,685
1,297
Last edited: Aug 30, 2015
cmartinez and planeguy67 like this.
7. ### planeguy67 Thread Starter Member

Jan 29, 2015
59
16
Thanks. Been all over that Wiki page. The trouble remains, I calculate an Fc, which gives me the frequency where the signal gets shifted by 90°. Take THAT frequency, plug it into the formula to calculate phase shift and I do NOT get 90° back out. Why?

I know I'm rusty with my trig, but the maximum value for an arc or inverse tangent is ±90°, correct? So the formula which multiplies that arctan by a factor of 2 should cover phase shifts of ±180°, which should pretty much cover the gamut of possible phase shifts.

8. ### planeguy67 Thread Starter Member

Jan 29, 2015
59
16
I have another formula for calculating the phase shift, but the result is equally useless:

Φ = -tan(2πfRC) + tan(-2πfRC)
In case you're wondering where I'm going with this, I would like to calculate OTHER frequencies that give me a different phase shift. For example, in the first post, I found the 90° phase shift occurred at 154 Hz. At what frequency would the phase shift equal 45°? Can't figure it out because the formula doesn't seem to work.

9. ### Papabravo Expert

Feb 24, 2006
10,338
1,850
In order to get 90° out of the arctan() function, the argument needs to approach ∞. Your expression for the argument actuallly approaches zero. I'd recheck that formula if I was you.

My TI-30 says that the arctan(1E99) = 90°, and I guess that is close enough for me.

https://en.wikipedia.org/wiki/All-pass_filter

The formula you actually want is:

So:

180° - 2*arctan(2*3.1415926*154*22,000*47e-9) = 89.97°

Also close enough for me.

Last edited: Aug 30, 2015
10. ### cmartinez AAC Fanatic!

Jan 17, 2007
3,698
2,756
And the arctan() function (performed in a computer, of course) does some pretty weird stuff when it's used with extremely large values.... that is because the number of digits used internally is actually finite

11. ### planeguy67 Thread Starter Member

Jan 29, 2015
59
16
Thanks Papabravo!!! You done broke the code! The formula I had, out of an e-Book no less, was wrong!!! See the attached screenshot. They placed the frequency in the denominator instead of the numerator. Everything makes sense now. Thanks!!!

cmartinez likes this.
12. ### crutschow Expert

Mar 14, 2008
13,475
3,361
Depends upon the goal.
Did you google all pass filter?
An all pass filter does indeed pass all frequencies but it provides a phase shift of 90° at the corner frequency. It's a way to provide a phase shift of near 0° to near 180° with a constant amplitude.
Sometimes all you want is a phase shift.

planeguy67 likes this.
13. ### shteii01 AAC Fanatic!

Feb 19, 2010
3,500
511
Yes, I followed AK wiki link. I just never encountered this name of it. In controls we talked about phase shift and mathematics of it, but we did not do circuits in that class.