How can I find the phase shift as a function of \$R_1\$? I found online that the equation is \$\phi = −2\arctan(R_1/X_c)\$, I just can't figure out why the 2 is there.
simulate this circuit – Schematic created using CircuitLab
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It only takes a minute to sign up.
Sign up to join this communityHow can I find the phase shift as a function of \$R_1\$? I found online that the equation is \$\phi = −2\arctan(R_1/X_c)\$, I just can't figure out why the 2 is there.
simulate this circuit – Schematic created using CircuitLab
With a circuit like this one, there are two options: the brute-force approach or the FACTs. For the first one, you can apply the superposition theorem with the input voltage alternatively biasing \$R_1\$ and \$R_3\$ or use the more mathematical KVL-/KCL-based approached described by Jan in his answer.
The second approach that I favor most of the time consists of determining the time constant of this circuit as described by the fast analytical circuits techniques or FACTs. As described in my book on the subject, the principle is simple: determine the time constant involving \$C_1\$ when the excitation is reduced to 0 V (\$V_{in}\$ is replaced by a short circuit) and when the response is nulled. We can start by setting \$s\$ to 0 (dc gain) and see what gain does this circuit exhibit. The below drawing shows the step for this dc analysis. If you do the maths ok (via superposition for instance), you find a gain of 1 regardless of the resistors values:
You then carry on with turning the source off and determining the resistance "seen" from \$C_1\$ terminals. It's easy in this case as it is \$R_1\$ and you have \$\tau_1=R_1C_1\$. Because with a 1st-order circuit the pole is the inverse of the time constant. The pole position is immediate and equal to \$\omega_p=\frac{1}{R_1C_1}\$. For the zero, either you determine the value of \$R\$ when the output is a null or you determine the gain of the circuit at high frequency e.g. when \$C_1\$ is replaced by a short circuit: \$H^1=-\frac{R_4}{R_3}\$. Applying this result by following the guidelines you have a zero located at \$\omega_z=-\frac{R_3}{R_4R_1C_1}\$ and this is a right-half-plane zero (RHPZ).
Since the pole and the zero are located at the same position, they neutralize each other in magnitude and the overall gain is 1 (0 dB) along the frequency axis. However, because of the zero located in the right half-plane, its phase response lags rather than leading as with a classical LHP zero. As a result, it combines with the naturally-lagging response of the pole and brings the phase from 0° down to -180°:
Because \$R_3\$ and \$R_4\$ are of equal values, the pole and the zero solely depend on \$R_1\$ and \$C_1\$. Considering a negative zero, the phase of the expression is thus classically computed as:
This is an all-pass filter which creates a delay whose value depends on the value of \$R_1\$ and \$C_1\$. If you push the maths a little more, this is a way to create a 1st-order Padé approximant of \$e^{-sT}\$ which is a pure delay.
First, I will present a method that uses Mathematica to solve this problem. When I was studying this stuff I used the method all the time (without using Mathematica of course).
Well, we are trying to analyze the following opamp-circuit:
simulate this circuit – Schematic created using CircuitLab
When we use and apply KCL, we can write the following set of equations:
$$ \begin{cases} \text{I}_\text{i}=\text{I}_1+\text{I}_3\\ \\ \text{I}_1=\text{I}_2\\ \\ 0=\text{I}_3+\text{I}_4\\ \\ \text{I}_2=\text{I}_\text{i}+\text{I}_4 \end{cases}\tag1 $$
When we use and apply Ohm's law, we can write the following set of equations:
$$ \begin{cases} \text{I}_1=\frac{\text{V}_\text{i}-\text{V}_2}{\text{R}_1}\\ \\ \text{I}_2=\frac{\text{V}_2}{\text{R}_2}\\ \\ \text{I}_3=\frac{\text{V}_\text{i}-\text{V}_1}{\text{R}_3}\\ \\ \text{I}_4=\frac{\text{V}_3-\text{V}_1}{\text{R}_4} \end{cases}\tag2 $$
Substitute \$(2)\$ into \$(1)\$, in order to get:
$$ \begin{cases} \text{I}_\text{i}=\frac{\text{V}_\text{i}-\text{V}_2}{\text{R}_1}+\frac{\text{V}_\text{i}-\text{V}_1}{\text{R}_3}\\ \\ \frac{\text{V}_\text{i}-\text{V}_2}{\text{R}_1}=\frac{\text{V}_2}{\text{R}_2}\\ \\ 0=\frac{\text{V}_\text{i}-\text{V}_1}{\text{R}_3}+\frac{\text{V}_3-\text{V}_1}{\text{R}_4}\\ \\ \frac{\text{V}_2}{\text{R}_2}=\text{I}_\text{i}+\frac{\text{V}_3-\text{V}_1}{\text{R}_4} \end{cases}\tag3 $$
Now, using an ideal opamp, we know that:
$$\text{V}_x:=\text{V}_+=\text{V}_-=\text{V}_1=\text{V}_2\tag4$$
So we can rewrite equation \$(3)\$ as follows:
$$ \begin{cases} \text{I}_\text{i}=\frac{\text{V}_\text{i}-\text{V}_x}{\text{R}_1}+\frac{\text{V}_\text{i}-\text{V}_x}{\text{R}_3}\\ \\ \frac{\text{V}_\text{i}-\text{V}_x}{\text{R}_1}=\frac{\text{V}_x}{\text{R}_2}\\ \\ 0=\frac{\text{V}_\text{i}-\text{V}_x}{\text{R}_3}+\frac{\text{V}_3-\text{V}_x}{\text{R}_4}\\ \\ \frac{\text{V}_x}{\text{R}_2}=\text{I}_\text{i}+\frac{\text{V}_3-\text{V}_x}{\text{R}_4} \end{cases}\tag5 $$
Now, we can solve for the transfer function:
$$\mathcal{H}:=\frac{\text{V}_3}{\text{V}_\text{i}}=\frac{\text{R}_2\text{R}_3-\text{R}_1\text{R}_4}{\text{R}_3\left(\text{R}_1+\text{R}_2\right)}\tag6$$
Where I used the following Mathematica-code:
In[1]:=Clear["Global`*"];
V1 = Vx;
V2 = Vx;
FullSimplify[
Solve[{Ii == I1 + I3, I1 == I2, 0 == I3 + I4, I2 == Ii + I4,
I1 == (Vi - V2)/R1, I2 == V2/R2, I3 == (Vi - V1)/R3,
I4 == (V3 - V1)/R4}, {Ii, I1, I2, I3, I4, Vx, V3}]]
Out[1]={{Ii -> ((R1 + R3) Vi)/((R1 + R2) R3), I1 -> Vi/(R1 + R2),
I2 -> Vi/(R1 + R2), I3 -> (R1 Vi)/((R1 + R2) R3),
I4 -> -((R1 Vi)/((R1 + R2) R3)), Vx -> (R2 Vi)/(R1 + R2),
V3 -> ((R2 R3 - R1 R4) Vi)/((R1 + R2) R3)}}
My equation was also confirmed using LTspice.
When we want to apply the derivation from above to your circuit we need to use Laplace transform (I will use lower case function names for the functions that are in the (complex) s-domain, so \$\text{y}\left(\text{s}\right)\$ is the Laplace transform of the function \$\text{Y}\left(t\right)\$):
$$\text{R}_2=\frac{1}{\text{sC}}\tag7$$
So, we can rewrite the transfer function as:
$$\mathscr{H}\left(\text{s}\right)=\frac{\frac{1}{\text{sC}}\cdot\text{R}_3-\text{R}_1\text{R}_4}{\text{R}_3\left(\text{R}_1+\frac{1}{\text{sC}}\right)}=\frac{\text{R}_3-\text{sCR}_1\text{R}_4}{\text{R}_3\left(1+\text{sCR}_1\right)}\tag8$$
Now, when working with sinusoidal signals we can use \$\text{s}:=\text{j}\omega\$ (where \$\text{j}^2=-1\$ and \$\omega=2\pi\text{f}\$ with \$\text{f}\$ is the frequency of the input signal in Hertz). So we get:
$$\underline{\mathscr{H}}\left(\text{j}\omega\right)=\frac{\text{R}_3-\omega\text{CR}_1\text{R}_4\text{j}}{\text{R}_3\left(1+\omega\text{CR}_1\text{j}\right)}\tag9$$
Now, you want to find the argument:
$$\arg\left(\underline{\mathscr{H}}\left(\text{j}\omega\right)\right)=\arg\left(\frac{\text{R}_3-\omega\text{CR}_1\text{R}_4\text{j}}{\text{R}_3\left(1+\omega\text{CR}_1\text{j}\right)}\right)=$$ $$\arg\left(\text{R}_3-\omega\text{CR}_1\text{R}_4\text{j}\right)-\arg\left(\text{R}_3\left(1+\omega\text{CR}_1\text{j}\right)\right)=$$ $$\arg\left(\text{R}_3-\omega\text{CR}_1\text{R}_4\text{j}\right)-\left(\arg\left(\text{R}_3\right)+\arg\left(1+\omega\text{CR}_1\text{j}\right)\right)=$$ $$\frac{3\pi}{2}+\arctan\left(\frac{\text{R}_3}{\omega\text{CR}_1\text{R}_4}\right)-\left(0+\arctan\left(\frac{\omega\text{CR}_1}{1}\right)\right)=$$ $$\frac{3\pi}{2}+\arctan\left(\frac{\text{R}_3}{\omega\text{CR}_1\text{R}_4}\right)-\arctan\left(\omega\text{CR}_1\right)\tag{10}$$
Now, when \$\text{R}_3=\text{R}_4\$ (which is the case in your circuit) we can simplify it a bit:
$$\arg\left(\underline{\mathscr{H}}\left(\text{j}\omega\right)\right)=\frac{3\pi}{2}+\arctan\left(\frac{1}{\omega\text{CR}_1}\right)-\arctan\left(\omega\text{CR}_1\right)=$$ $$2\left(\pi-\arctan\left(\omega\text{CR}_1\right)\right)\tag{11}$$
Short answer:
Using superposition, the transfer function (first order allpass, special case R3=R4) is
H(s)=[1/(1+sR1C1)]*[1+1]-1=[2-(1+sR1C1)] / (1+sR1C1)=(1-sR1C1) / (1+sR1C1) .
Phi=Phi_n - phi_d = arctan(-wR1C1) - artan(wR1C1) = -2arctan(wR1C1).