It compares the actual output voltage with reference sine wave and generates switching signal accordingly. As the MOSFET works as switch, output will never be sinusoidal. So, inductor and capacitor are placed to filter out switching noise. So, the output will be nearly sinusoidal.
Niranjan Bhujel (2019). Single Phase Sine Wave Inverter with Feedback Control (https://www.mathworks.com/matlabcentral/fileexchange/62627-single-phase-sine-wave-inverter-with-feedback-control), MATLAB Central File Exchange. Retrieved .