Next, the switching points must be determined, and they'll be the voltages at the R4-R5 junction (V3V4) when V2 is equal to minus 3 volts and when it's equal to 5 volts.
$$ V3 = \frac{(V1-V2)\times R5}{R4+R5} +V2 $$$$ V4 = \frac{(V1-V2)\times R5}{R4+R5} +V2 $$
$$ V3 = \frac{(V1-V2)\times R5}{R4+R5} +V2 = \frac{13V\times 10k\Omega}{20k \Omega} -3V = 3.5\text { volts} $$$$ V4 = \frac{(V1-V2)\times R5}{R4+R5} +V2 = \frac{13V\times 10k\Omega}{20k \Omega} -3V = 3.5\text { volts} $$
Similarly, when V2 is equal to 5 volts, V3V4 will be equal to 7.5 volts
Since V2 and V3 vill now both be at 5 volts, U2+ will also be at +5 volts, and since U2 is a unity-gain voltage follower, its output will be at 5 volts, which will be connected to R10 through the now closed S2.
Since R8 and R9 comprise a 2:1 voltage divider because R8 and R9 have equal resistances, and with its tap connected to U2+, as V2 rises above 5 volts, the voltage on U2U2+ will rise at half that rate, satisfying the requirementsrequirement for the slope in Vout above 5 volts.
R8 and R9 comprise a voltage divider with their junction
So, the result of all this is that V2 will be connected to R8 from the time it's betweenV2 is between -10 volts and -3 volts. After that, then as itwhen V2 goes more positive than -3 volts, R8 will be disconnected from V2 and Vout will snap up to zero volts until V2 gets to 5 volts, when R8 will again be connected To U2's output and will snap upt to +5 volts. Thereafter, V2 will stay connected to U2's output for as long as V2 staystays more positive than 5 volts.
Here's the drawingThe schematic follows, and if you want to play around with the circuit, here's the LTspice .asc file so you can simulate it.