I'm trying to obtain BJT characteristics in NGSPICE, but for some reason the plots retrace to origin.

BJT characterics

* BJT characteristics

RB 1 2 1Meg
RC 4 3 1k
QBJT 3 2 0 BC107B
V1 1 0 dc 12
V2 4 0 dc 10

.model BC107B   NPN(Is=7.049f Xti=3 Eg=1.11 Vaf=59.59 Bf=381.7 Ise=59.74f
+               Ne=1.522 Ikf=3.289 Nk=.5 Xtb=1.5 Br=2.359 Isc=192.9p Nc=1.954
+               Ikr=7.807 Rc=1.427 Cjc=5.38p Mjc=.329 Vjc=.6218 Fc=.5 Cje=11.5p
+               Mje=.2718 Vje=.5 Tr=10n Tf=438p Itf=5.716 Xtf=14.51 Vtf=10)
*       PHILIPS     pid=bc107b  case=TO18
*       91-08-02 dsq

.dc V2 0 10 0.1 V1 1.5 3.5 0.5 

plot v(4,3)/1k vs v(3) 


How do I resolve this issue?

  • \$\begingroup\$ Plot it with dots instead of lines? \$\endgroup\$ – The Photon Aug 15 '15 at 2:19
  • 1
    \$\begingroup\$ This program has been solved in ngspice-32. \$\endgroup\$ – dachuan lin Jun 30 at 3:51

I don't know if you absolutely need to use NGSPICE, but with LTspice you would have no problems (see below).

Note: LTspice is completely free and has no limitations (no max number of parts, for example, like the free crippled version of other commercial simulators). It is one of the best simulators around (it is used by Linear Technology for in-house simulations - it is no toy). The program is lightweight (~40MB, IIRC), works under Windows and was developed to be run in Linux under WINE. The license is very liberal: you can also use it for commercial purposes, as long as you are not a competitor of Linear Technology (you do not work for a chip manufacturer, do you? :-).

The following snapshot illustrates the point. I just created an empty schematic and copied the essential part of your netlist into a spice directive in LTspice and plotted Ic after running the simulation. Here is the result:

enter image description here

Of course you could redraw the schematic from scratch, if you needed that, but if you only need the curves that is as easy as it gets.

| improve this answer | |

How do I resolve this issue?

The easiest way is to post such bugs on the SourceForge ngspice forum...

Change around line 277 of graf.c .

if (np && (tox > fromx)) 
    DevDrawLine(fromx, fromy, tox, toy);
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.