This is an Op Amp Level Shifter of the form Vout=m*Vin-b where m = slope, and b = offset, with a negative offset
This circuit takes a 1v amplitude sinewave (2V P-P) centered on 3V, amplifies and shifts it down to between 0-4V. One has to be careful about the shift b=Vout_zs - m*Vin_zs, or the difference between the zero-scale (bottom) of the output waveform and the zero-scale (bottom) of the input waveform (b = 0 - 2 * 2 = 4 in this case) The linear transform takes Vin and makes Vout = m *Vin + b with m = 2 and b = -4V by using (approximately) these components:
Vref = 12V -- chosen arbitrarily.
Rf = 100k
== Precise OpAmp ref option:
Rg = 100k/(2-1) =100k
Vref' = |-8|/2 = 4
R2 = 100k
R1 = 100*(12V-4)/4=200k
==== 1 OpAmp Approx soln option:
Rg2 = Rg/10 =90k
Rg1 = Rg -Rg2 =10k
Vref' = |-8V|*90k/(90k+100k)=3.78V
R1 = 10k*(12-3.78)/3.78 = 21.7k
R2 = 12V *10k * 2/2 = 50k
Rf = 100k
Rg = 50k*100k/(2*(10k+50K)-50k)=71.4k
Calculations:
Choose Vref ____
Choose Rf ____
Rg = Rf/(M-1)
Vref' = |b|/m
Choose R2 ____
R2 = R1*(Vref-Vref')/Vref'
== Approx calcs:
Rg2 = Rg/10
Rg1 = Rg - Rg2
Vref' = |b|*Rg1/(Rg1+Rf)
R1 = Rg2*(Vref - Vref')/Vref'
R2 = Vref * R1 *m / b
Choose Rf _______ (from datasheet)
Rg = R2*Rf/(m * (R1+R2) - R2)
Op amps require 4 different circuits depending on the signs of the coefficients. See https://www.ti.com/lit/an/sloa097/sloa097.pdf for a reference.