I'm having some trouble working out the transfer function of the below circuit. It's coming from here. \$R_K\$ is changing in increments of 1k about 8 times. Supposedly if you plot this against an exponential function it approximates it fairly well (<1%). However, when I plot my values with that transfer function I get different results so I'm guessing my math is off.
Or I'm just misunderstanding how the complete circuit from Hackaday works and another element is having the "exponential effect". However, I don't think so due to this paragraph: "So, I found a way to combine two op amps and a few resistors in such a way that a linear increase in resistance from the keyboard turns into an almost exponential voltage that the oscillator can use. Technically the response is polynomial not exponential, but the polynomial is within a fraction of a percent of a true exponential."
simulate this circuit – Schematic created using CircuitLab
I couldn't figure out how to get current arrows into the schematic, sorry.
My basic assumptions are:
$$ i_1 = -i_2\\ i_1 = i_P - i_K\\ R_3 = 2*R_4\\ R_2 = 2*R_1\\ $$
and then my math goes like this:
\begin{equation} i_2 = \frac{(V_O - \frac{V_{in}}{3})}{R_2} \end{equation}
\begin{equation} V_P = V_{in} - \frac{V_{in}}{3} - V_{R1} = \frac{2*V_{in}}{3}-i_1*R_1 \end{equation}
\begin{eqnarray*} i_1 &=& \frac{V_P}{R_P} - \frac{(V_{in}-V_P)}{R_K} \\ &=& \frac{(\frac{2*V_{in}}{3}-i_1*R_1)}{R_P}-\frac{(V_{in}-\frac{2*V_{in}}{3}+i_1*R_1)}{R_K} \\ &=& V_{in} * \frac{(8*R_K-12*R_P)}{(12*R_P*R_K+6*R_2*R_K+2*R_2*R_P)} \\ \end{eqnarray*}
at which point I put everything into \$i_1 = -i_2\$:
\begin{equation} V_{in} * \frac{(8*R_K-12*R_P)}{(12*R_P*R_K+6*R_2*R_K+2*R_2*R_P)} = \frac{(\frac{V_{in}}{3} - V_O)}{R_2} \\ \ldots \\ \ldots \\ V_O = \frac{V_{in}}{3}*\frac{(2*R_P*R_K-3*R_2*R_K)}{(2*R_P*R_K+R_2*R_K+R_2*R_P)} \end{equation}
My guess is I mucked something up with the voltage around the op amp inputs since it's not GND, but despite a few approaches (the math above being the last one) I can't figure out where my mistake is. I skipped putting some steps in my math in the post so it stays somewhat compact.
Now, I'm not necessarily looking for a full worked example (although I'll also gladly take that), I'm more than happy if someone can give me a hint where I made a mistake and maybe even explain what that mistake is.
This is my first time asking a question so if I did something wrong (like formatting the formulas in a weird way) please tell me so I can do better next time.