It measures capacitor voltage and compare with reference dc voltage. Their difference is passed to PI controller which calculates the power to be drawn and hence current to be drawn from input. This reference input current is compared with actual input current by hysteresis band controller. If actual current is less than reference one, switch is turned on and current start to increase. If actual current is greater than reference one, switch is turned off. In this way, output votage is maintained.
To work as buck converter, To work as buck converter, put Vref less than Vin.
To work as boost converetr, put Vref greater than Vin.
Niranjan Bhujel (2019). Inverting buck-boost converter (https://www.mathworks.com/matlabcentral/fileexchange/62271-inverting-buck-boost-converter), MATLAB Central File Exchange. Retrieved .