I'm trying to figure out how this circuit works:
It is a absolute value circuit; that is, the output follows the absolute value of the input. In the process of figuring out how it works, I am imagining a positive input voltage. If this is the case, then the first op-amp acts as an inverter, so the voltage above the diode is the negative of the input. So, I understand how the first part works. I then get stuck on the second part: The voltage at the non-inverting input to the second op-amp is Vin since no current flows through the lower resistor. If this is true, then the second op-amp tries to make the inverting input also equal to Vin. If it achieves this, then there is a voltage drop of 2Vin across the input resistor to the second op-amp, and hence a current of Vin/5000 flows through the feedback resistor. There is a voltage drop of 2Vin across the feedback, so the output voltage is either -Vin or 3Vin.
Can you please pick apart my logic and tell me why I'm wrong? I've been trying to puzzle it out for ages but I can't see the solution.