diode circuit example, dc and ac small signal analysis * a line that begins with a * is a comment in Spice * * set width of printed output to 80 columns .width out=80 * * specify the circuit (e.g. resistor r1 is connected between nodes 1 and 2 * and has a value of 1K ohm. NOTE THAT NODE ZERO IS RESERVED FOR GROUND) * r1 1 2 1k r2 2 0 1k * * when specifying a diode, we also need to specify a model * that describes the diode. in this case, the model name is m1 * d1 2 0 m1 * * specify the dc power supply * vsup 1 3 dc 10 * * specify the ac small signal source * vs 3 0 ac 0.010 * * specify the diode model parameters * .model m1 D(is=1.0e-14 n=1.0 cjo=10p m=0.5 vj=0.8 ) * * request an operating point analysis from Spice * .op * * request an ac analysis over 5 decades in frequency * .ac dec 5 0.1 1000meg * * specify printed output (ac voltage across the diode) * .print ac v(2,0) * * make a plot of the ac voltage across the diode vs. frequency * .plot ac v(2,0) * * must have an .end line * .end