This example shows a simple voltage regulator circuit constructed from discrete components. A fluctuating supply is modeled as 20V DC plus a 1V sinusoidal variation. The zener diode D1 sets the non-inverting input of the op-amp to 3.2V, and hence as the op-amp has a large gain, the op-amp inverting input and output are also at 3.2V. Hence the regulator voltage output is regulated to be 3.2*(1000+470)/470=10V. The NPN bipolar transistor is required to provide higher currents than is possible from a typical op-amp. The model can be used to check circuit operation, and to support selection of components to achieve the desired voltage regulation.
The plot below shows the output of the voltage regulator holding at a constant 10V even as the input voltage fluctuates.