# Thread: Phase calculation formula - can't even use the correct formula properly!!

1. ## Phase calculation formula - can't even use the correct formula properly!!

Whilst, this may be a electronics-centric issue ....it heavily depends on maths, hence asking a forum where folks a clued up wrt maths! (I'm not) - I've asked on electronics forums, but have had a mixed response!

I've an electronic circuit where I desperately need to establish the phase shift for a particular frequency put through the circuit.

There are two components in my particular circuit which will decide the phase shift for a given frequency through the circuit (see the diagram below - C1 & R1)

Capacitor (C) for my circuit, I'm using a value of 0.0000000022
Resistor (R) for my circuit I'm using a value of 47000

Ok, for those two values there's a very simple formula which tells me the frequency where the phase shift will be exactly 90 degrees for the circuit I'm using (an allpass filter), this is the so called 'centre frequency' & is referred Fo, so for the above

Fo = 1 / (2TT * RC) (the TT is meant to look like Pi!)

Fo = 1 / 6.28319 * 47000 * 0.0000000022)

That works out at 1539.22Hz.....so for a capacitor of 0.0000000022 (farads) & a resistor of 47000 (ohms), a 90 degree phase shift (the centre frequency) will occur at 1539.22Hz through the circuit

Great I now have some values which I know are correct that I can apply to a much more foreboding formula!

I'd really like to know the phase shift is for other frequencies through that I put through the same circuit with those same values for C & R (it's not much good only knowing which frequency is moved exactly 90 degrees).Alas the formula (to my eyes at least) is a beast. Here it is....

the article from where I sourced it (Tech Brief 3: Digitally Control Phase Shift - Maxim) is applying the formula to this circuit, so the C1 & R1 is just the numbering scheme for the components (C & R essentially)...

My first hurdle is that 'w' in the above formula relates to frequency in in rad/s (vs Hertz) which is completely new to me.

Fortunately there's online calculator (Convert hertz to rad/sec - Conversion of Measurement Units) , so if I punch in

1539.22HZ .... it converts to 9671.204477466 rad/s

Therefore I now have all the data necessary to input & try & use that foreboding formula.

With my values of C, R and Rad/s, the formula outcome should be 90 (degrees), but being a bit poor at maths, I can't even get the formula to come out anything that resembles an outcome of 90!

Is anyone speedy enough with such things to see if they use/input the following values to that formula above, that the outcome is close to 90?

C = 0.0000000022
R = 47000
w = 9671.204477466

My goal is to have an Excel spreadsheet where I can see the phase shift for different frequencies when changing the values for either frequency Capacitance (C) or Resistance (R)

Many thanks

2. The connection between F (frequency in Hz) and $\omega$ (rad/s) is $\omega = 2\pi F$. If you replace $\omega$ by $2\pi F$ in the formula for the phase, you get

. . . . . $\displaystyle\textit{Phase} = \tan^{-1}\left({\frac{4\pi F}{RC}\above1pt 4\pi^2F^2 - \bigl(\frac1{RC}\bigr)^2}\right).$

That is the formula for the phase in terms of F, R and C. Notice that if $2\pi F = 1/(RC)$ then the denominator of the big fraction will be zero, so the phase will be " $\tan^{-1}$ of infinity", namely a right angle (90 degrees or $\pi/2$ radians). That is what happens for the numerical values of F, R and C that you give.

If you are doing this on an Excel spreadsheet, you will need to check whether the $\tan^{-1}$ function gives answers in degrees or radians. (I don't use Excel at all, so I have no idea how it copes with inverse trig functions.)

3. when calculating the phase shift, of the current or voltage in some part of your scheme... it would be probably more simple to use :

$\displaystyle x_L = j \omega L$

$\displaystyle x_C = \frac {1}{j\omega C}$

so when using complex numbers you can write them as

$Z = \rho e ^{i \varphi}$

than, when you need to see phase shift of the current in some part of your scheme when applying basic laws (Ohms law I=U/Z) you immediately get the phase shift (if there is any) or of course voltage shift the same way ....

that's if you need to see phase shift in radians, but as the Opalg mention, to get it in Hz just instead $\omega$ write $2\pi f$ .....

Analysis of the electric schemes are done that way ....

I'm sorry if you are not familiar with complex numbers, but if you are calculating phase difference between current and voltage i assume that you know that anyway if you don't here you are :

$Z = \Re + \Im$

(resistor have just real part , C and L have just imaginary part)

$Z = \rho e ^{i \varphi}$

where

$\rho = \sqrt {\Re^2 +\Im ^2 }$

$\displaystyle \varphi = arctan \frac {\Im}{\Re}$

Edit : phase shift that happen when you change frequency is happening because your Z changes as frequency goes up your X_L goes up, and X_C goes down (frequency goes down X_L going down, X_C going up ) with all that and of course with starting phase of the current and voltage you have at the end different (or the same) phase between the current and voltage ....

4. many thanks to you both (Mickey,, I'm still standing on my chair trying to catch all that information that mostly went over my head - I'm not strong in maths!!)

So, tackling the non rad/s version (I'm an old dog & prefer to work in Frequency ...ie Hertz), I'm lookin at this...

. . . . . $\displaystyle\textit{Phase} = \tan^{-1}\left({\frac{4\pi F}{RC}\above1pt 4\pi^2F^2 - \bigl(\frac1{RC}\bigr)^2}\right).$

Can one of you watch me walk through this?

I'm looking to get a result of 90 (I know this is true!), using these input values for the formula

F = 1539.22 (ie Hertz)
C = 0.0000000022 (capactance of the circuit)
R = 47000 (Resistance of the circuit)
4TT = 12.5663706

top line within the brackets 4TTF/RC = 187063916.391992 (I'm not sure how many decimal places are required to get an accurate phase result!)

Ok that lower line within the brackets - do I square the whole line or just the latter 1/RC should be squared?

I suspect the latter (else some brackets would have come into play?), ok if so, then the lower line within the brackets will be 374128784.179834 minus 93531720.3476387 = 280597063.832195

Ok, now divide the top line within the brackets by the lower line within the brackets = 187063916.391992 divided by 280597063.832195 = 0.666663841157874

so how do I "tan-1" that number ( 0.666663841157874)....and does it equal 90? (my goal is excel, but I don't even know how to tan-1 on a calcualtor!)

Or which bit have I done wrong?

Edit: I found an online calculator ( http://www.mathsisfun.com/scientific-calculator.html) & tan-1 (atan?) for 0.666663841157874 came out as 11.0351498001355 degrees - FAIL!

5. hmm... on calculator arctan is type number than (depending on calculator) pres "2nd F" (meaning second function) than pres "tan"
but that result that you get (i didn't check your work just this) arctan (0.666) = 33.68 ° so it's not

well tell me in which part of that scheme you need to find phase an of what ? (current or voltage, trough which element, or at the exit ... )

that "formula" that you got there, is based by the way elements in your scheme are connected, so there is no universal "formula", so you could apply it in every scheme to calculate phase... (and again what phase ? current or voltage ? and in which part )

So, tackling the non rad/s version (I'm an old dog & prefer to work in Frequency ...ie Hertz), I'm lookin at this...

. . . . . $\displaystyle\textit{Phase} = \tan^{-1}\left({\frac{4\pi F}{RC}\above1pt 4\pi^2F^2 - \bigl(\frac1{RC}\bigr)^2}\right).$

Can one of you watch me walk through this?

I'm looking to get a result of 90 (I know this is true!), using these input values for the formula

F = 1539.22 (ie Hertz)
C = 0.0000000022 (capactance of the circuit)
R = 47000 (Resistance of the circuit)
4TT = 12.5663706

top line within the brackets 4TTF/RC = 187063916.391992 (I'm not sure how many decimal places are required to get an accurate phase result!)

Ok that lower line within the brackets - do I square the whole line or just the latter 1/RC should be squared?

I suspect the latter (else some brackets would have come into play?), ok if so, then the lower line within the brackets will be 374128784.179834 Where did that come from? minus 93531720.3476387 = 280597063.832195
I can't see where you got the 374128784.179834 from. It is supposed to be $4\pi^2F^2 = 4(3.14159265)^2(1539.22)^2 \approx 93532196$. In fact, I suspect that the value you are taking for F is not quite exact enough to get a 90 degree phase shift. It should be more like 1539.2161, and then $4\pi^2F^2$ would be about 93531720, which would cancel with the other term in the denominator of the big fraction and leave you with zero.

7. Ok, I'm doing something wrong - I'll double check my effort! (this doesn't come easy to me)

Originally Posted by yeKciM
well tell me in which part of that scheme you need to find phase an of what ? (current or voltage, trough which element, or at the exit ... )
Two voltage signals (like for like) one as seen at the beginning of the circuit, the other seen at the output of the circuit - the circuit is an all pass filter.

8. $\displaystyle \arctan{( \frac {\frac {2 \cdot 10^4}{1.034 \cdot 10^{-4}}}{(4)\cdot (9.87) \cdot (2.37 \cdot 10^6) - \frac {1}{(4.84\cdot 10^{-18}) \cdot ( 2.209 \cdot 10^9)}})}=\arctan {(\frac {1.93 \cdot 10^8}{9.35\cdot 10^7 - 9.35\cdot 10^7 })}=\arctan {(\frac {1.93 \cdot 10^8}{0})}$

so it's correct