Type 3 compensator design for Buck-Boost converter
This is an excerpt of the book I wrote on switching power supplies. The exercise consists of stabilizing a buck-boost converter whose schematic diagram appears below:



In the left side of the drawing, you can see a list of variables. These variables correspond to information extracted from the open-loop response of the power stage. However, considering the negative voltage delivered by the buck-boost converter, we will observe the response after the inverting block \$E_1\$. Then, we will extract the attenuation at the selected 5-kHz crossover frequency. The phase is important and will let us compute the necessary phase boost to calibrate the type 3 compensator and place poles and zeroes. However, in this exercise, the position of these elements has been done earlier in the text. The power stage response \$H(s)\$ is here:



The left-side macro will now compute the components values around the op-amp to provide a gain of 9.6 dB at 5 kHz and sufficient phase boost at this frequency. The amount of phase boost will lead to the targeted phase margin, neglecting the op-amp contribution here. Owing to this approach, it is easy and fast to change the positions of the poles and zeroes and immediately see the effect on the transient response or the open-loop gain. The computed values are here:



The incriminated resistance \$R_2\$ is 16.8 k\$\Omega\$ and not 18.6 k\$\Omega\$ as mistakenly printed. Once these values are applied, the compensated loop gain is here:



It is important to note that the op-amp plays a role and can affect the expected gain and phase boost, leading to a smaller phase margin than expected. I  have covered this aspect in a series of articles published on How2Power.com some time ago.