I am trying to simulate a simple linear regulator using gschem and ngspice. However, my output voltage varies by over a volt as my input voltage goes from 10V to 20V. Can I reduce this swing in the output voltage by changing circuit parameters or is this a characteristic of linear regulators?

My circuit looks like this:

![Circuit diagram](https://i.stack.imgur.com/HlWjB.png)

And the netlist that gets generated (witl the comments and models stripped out) is this:

```
V1 Vin 0 16.8
C2 0 Vout .1uF  
C1 2 0 1000uF  
D1 2 0 1N4004 
R5 q1base 0 1k  
R4 q1base 3 5k  
R3 Vout 3 1k  
R1 q2base Vin 2k  
Q1 q2base q1base 2 2N4401 
Q2 Vin q2base 1 2N4401 
Q3 Vin 1 Vout TIP29 
.end

```

When I perform a dc sweep on v1 by doing `dc v1 5 25 .1` my output is as follows:

![Simulation results](https://i.stack.imgur.com/mlpfd.jpg)