Amal Banerjee
2012-11-24
Could some ngspice guru please help ?
I am running ngspice - 24 on a Fedora 15 machine.
I have the following two statements in a netlist:
VG2 2 0 DC 0.0 SIN(0 10 200K 0 0)
VG1 4 0 DC 0.0 SIN(0 5 1000 0 0)
The second SIN produces a perfect sine wave.
The first produces a set of spikes at start and end,
using:
.TRAN 50.0us 7500.0us 10.0us UIC
May O know what the problem might be ? I have
checked by decoupling the circuit that is being
fed with these signals, from the signal sources
and the result is the same. The ngspice manual
states: SIN(Vo VA FREQ TD ThETA)
Any hints, suggestions would be helpful.
Robert Larice
2012-11-24
dakuu,
your timestep specified in the .tran step to be 50us
is much too large to sample a 200kHz sine wave.
reduce it to something considerably smaller than 5us
in other words, you have down sampled 200kHz
with a 1/50us = 20kHz sampling frequency
to Zero, that is to DC
if ngspice would have exactly sampled at
k * 50us
you would have seen exclusively zero samples.
but ngspice starts with smaller timestamps,
thus your samples are not all at k*50us
and thus some of your samples dont happen
to yield zero voltage.
try print allv to see the exact sample points,
and how they differ from k * 50us
Robert