How to plot pole zero results in ngspice

Jan 18, 2007 10 Replies

First reply

habib.bouaziz-viallet

Hi Hugo So far i've never used PZ plotting. But, have you ever used polar or smith(grid) parameters within plot command ? May be is it possible to feed GnuPlot with PZ results ... Habib

Read the full reply

As my previous thread in this group became more or less off topic after a while, I start this new one with a related but different question: I now can perform pole zero analysis with ngspice (using the command line mode). I'm trying to _plot_ the pole zero diagram like this: source inputfile run plot pole(1) pole(2) ylimit -1 1 xlimit -10 0



I hoped to see the poles displayed with an "x" and the zero with an "o" Unfortunately that seems not the way to do it. I _do_ get a grid with the correctly scaled axis but I can't distinguish the poles and zeroes on it. Is this possible with ngspice?



regards, hugo



here is the inputfile: test vin 1 0 ac 1 r1 1 2 1 c1 2 0 1 r2 1 3 1 c2 3 2 1 .print ac v(3) .ac dec 20 1m 10k .end



Le Wed, 17 Jan 2007 23:17:42 -0800, snipped-for-privacy@gmail.com a écrit :

Hi Hugo

So far i've never used PZ plotting. But, have you ever used polar or smith(grid) parameters within plot command ? May be is it possible to feed GnuPlot with PZ results ...

Habib

Hi Habib, In fact I use Gnuplot now as a "workaround" for plotting my PZ results, I copy and paste the results of the pz-analysis in a data-file and then plot them using Gnuplot. If I could tell ngspice to produce a pz-analysis in batch (like ngspice

Le Thu, 18 Jan 2007 01:48:39 -0800, snipped-for-privacy@gmail.com a écrit :

Ok then, I understand what are your needs ... I did this (mostly perfectible !)

#!/bin/sh

touch report_binary.out touch report_ascii.out echo "run" | ngspice -b test.cir -r report_binary.out | ngsconvert b report_binary.out a report_ascii.out rm report_binary.out cat report_ascii.out

I will improve it later ... may be.

Cheers, Habib

feed

rt_binary.out a report_ascii.out

unfortunately this does not work as you get again an error message (see previous thread) for the pole-zero analysis: echo "run" |ngspice -b test.cir gives: Error: no data saved for pole-zero analysis; analysis not run

thanks for trying

hugo

Le Fri, 19 Jan 2007 00:27:01 -0800, snipped-for-privacy@gmail.com a écrit :

report_binary.out a report_ascii.out

Hi Hugo, the shell-script above (run.sh) runs on my Debian, see what i have :

habib@aldebaran:~/GNU-TOOLS/ng-spice-rework-17/tests/polezero$ ./run.sh No. of Data Columns : 5

No. of Data Rows : 121 No. of Data Columns : 3

No. of Data Rows : 1 Title: test Date: Fri Jan 19 08:57:16 2007 Plotname: Pole-Zero Analysis Flags: complex No. Variables: 3 No. Points: 1 Variables: 0 pole(1) voltage 1 pole(2) voltage 2 zero(1) voltage Values: 0 -2.618033988749895e+00,0.000000000000000e+00 -3.819660112501052e-01,0.000000000000000e+00 -3.333333333333333e-01,0.000000000000000e+00

habib@aldebaran:~/GNU-TOOLS/ng-spice-rework-17/tests/polezero$

:

to feed

ts,

hen

eport_binary.out a report_ascii.out

can you show me the contents of your test.cir?

regards, hugo

Le Fri, 19 Jan 2007 11:54:43 -0800, snipped-for-privacy@gmail.com a écrit :

feed

report_binary.out a report_ascii.out

Sure Hugo,

test vin 1 0 dc 0 ac 1 r1 1 2 1 c1 2 0 1 r2 1 3 1 c2 3 2 1

.print ac v(3)

.pz 1 0 3 0 VOL PZ .ac dec 20 10m 10k

.end

It's always the same (yours in fact) test circuit !

Habib

:

rit :

r or

le to feed

sults,

d then

also

b report_binary.out a report_ascii.out

see

See what I get with the run.sh mentioned above and this test.cir: coolens@antec:~/pald$ ./run.sh Usage: sconvert fromtype fromfile totype tofile, where types are o, b, or a or, sconvert fromtype totype, used as a filter. No. of Data Columns : 5

No. of Data Rows : 121 No. of Data Columns : 3

No. of Data Rows : 1 ./run.sh: line 6: report_binary.out: command not found

I think there is something wrong with the ngsconvert b

regards, hugo

Le Sat, 20 Jan 2007 08:11:01 -0800, snipped-for-privacy@gmail.com a écrit :

to feed

results,

then

report_binary.out a report_ascii.out

Hi Hugo,

I think you forgot a CR-LF sequence after each shell instruction line in run.sh.

Cheers, Habib

:

rit :

=E9crit :

olar or

sible to feed

results,

and then

ld also

rt b report_binary.out a report_ascii.out

e (see

t i

n=2Esh

now it works perfectly, thank you very much Habib

hugo

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required