Richie Fan
03/27/2024, 3:21 AMStefan Schippers
03/27/2024, 8:10 AMgain
) and phase (ph(gain)
)(in degrees).
If you plot ph(gain)
you will see it has a phase of 180deg, so gain
it is actually a negative real number.
To see the correct gain just plot this:
"vout vin / db20()"
(including quotes)
You can display also an alias name for the wave:
"gain; vout vin / db20()"
this expression means:
create a new "gain" wave, by taking vout and vin, dividing the first by the second and applying 20*log10() (db20()).Stefan Schippers
03/27/2024, 8:27 AMlet gain=db(v(diffout)/v(minus))
and magnitude and phase plotted in xschem, vs the xschem-calculated gain.Matt Venn
03/29/2024, 12:39 PMMatt Venn
03/29/2024, 12:39 PMMatt Venn
03/29/2024, 12:45 PMStefan Schippers
03/30/2024, 10:45 AMout
in a ngspice generated AC raw file is a complex number: out = re + i * im
.
Since we are mostly interested in magnitude and phase rather than real and imaginary parts (unless when doing nyquist plots) xschem transforms data out=re + i * im
into magnitude: out = √(re² + im²)
and phase: ph(out) = atan2(im, re)*180 / π
. So, yes ph(out)
is xschem specific, it is the phase of out
measured in degrees.
> if it's xschem, why is not "out ph()" like the gain "out db20()" ?
Because as said above in xschem out
is the magnitude of ngspice saved node out
. You can't get a phase out of a magnitude. Xschem already has transformed the complex ngspice-saved number out
into magnitude (out
) and phase in degrees (ph(out)
). The db20() function just does 20*log10(out)
to transform magnitude out
into a value in dB
> and how does xschem know to use the ac analysis in the plhase and gain plots (I'm looking a the ac example in the xschem demos)
If there is only one simulation (only one AC sim for example) xschem will load this one and figure out it's an AC plot. If there are multiple simulations (op, dc, tran, ac) the graph can specify which simulation to load. See the Raw file and Sim type text boxes.Matt Venn
03/31/2024, 5:30 PMMatt Venn
03/31/2024, 5:32 PMStefan Schippers
04/02/2024, 8:56 AMso is ph(out) a variable name then?Yes, from every complex variable
xxx
(two real numbers, one representing the real part, the other the imaginary component) saved by ngspice in ac raw files xschem creates xxx
(the magnitude) and ph(xxx)
(the phase in degrees)Stefan Schippers
04/02/2024, 9:03 AMMatt Venn
04/02/2024, 3:34 PMSud_ana
04/17/2024, 10:33 PMtest_nyquist.sch
could be shared or where are the ac examples in the xschem repo ?
I tried the ngspice expression for the imaginary part as imag(vout_vector)
but it doesn't generate a nyquist plot.Stefan Schippers
04/18/2024, 10:07 AMLinen is a search-engine friendly community platform. We offer integrations with existing Slack/Discord communities and make those conversations Google-searchable.
Powered by