How to plot pole zero results in ngspice

  • Thread starter hugocoolens@gmail.com
  • Start date
H

hugocoolens@gmail.com

Guest
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, hugocoolens@gmail.com a écrit :

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
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
 
habib.bouaziz-viallet schreef:
Le Wed, 17 Jan 2007 23:17:42 -0800, hugocoolens@gmail.com a écrit :

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

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 ...
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 <input.cir) and _not_ interactively
in command mode, I could write a little script to do all this
automatically. But as ngspice has it's own plot facility I would also
be happy if that could give me a nice plot.

regards,
hugo
 
Le Thu, 18 Jan 2007 01:48:39 -0800, hugocoolens@gmail.com a écrit :

habib.bouaziz-viallet schreef:
Le Wed, 17 Jan 2007 23:17:42 -0800, hugocoolens@gmail.com a écrit :

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

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 ...
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 <input.cir) and _not_ interactively
in command mode, I could write a little script to do all this
automatically. But as ngspice has it's own plot facility I would also
be happy if that could give me a nice plot.
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

regards,
hugo
 
habib.bouaziz-viallet schreef:
Le Thu, 18 Jan 2007 01:48:39 -0800, hugocoolens@gmail.com a écrit :


habib.bouaziz-viallet schreef:
Le Wed, 17 Jan 2007 23:17:42 -0800, hugocoolens@gmail.com a écrit :

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

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 ...
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 <input.cir) and _not_ interactively
in command mode, I could write a little script to do all this
automatically. But as ngspice has it's own plot facility I would also
be happy if that could give me a nice plot.
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

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, hugocoolens@gmail.com a écrit :

habib.bouaziz-viallet schreef:
Le Thu, 18 Jan 2007 01:48:39 -0800, hugocoolens@gmail.com a écrit :


habib.bouaziz-viallet schreef:
Le Wed, 17 Jan 2007 23:17:42 -0800, hugocoolens@gmail.com a écrit :

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

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 ...
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 <input.cir) and _not_ interactively
in command mode, I could write a little script to do all this
automatically. But as ngspice has it's own plot facility I would also
be happy if that could give me a nice plot.
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

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
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$


 
habib.bouaziz-viallet schreef:
Le Fri, 19 Jan 2007 00:27:01 -0800, hugocoolens@gmail.com a écrit :


habib.bouaziz-viallet schreef:
Le Thu, 18 Jan 2007 01:48:39 -0800, hugocoolens@gmail.com a écrit :


habib.bouaziz-viallet schreef:
Le Wed, 17 Jan 2007 23:17:42 -0800, hugocoolens@gmail.com a écrit :

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

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 ...
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 <input.cir) and _not_ interactively
in command mode, I could write a little script to do all this
automatically. But as ngspice has it's own plot facility I would also
be happy if that could give me a nice plot.
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

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
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$
can you show me the contents of your test.cir?

regards,
hugo
 
Le Fri, 19 Jan 2007 11:54:43 -0800, hugocoolens@gmail.com a écrit :

habib.bouaziz-viallet schreef:
Le Fri, 19 Jan 2007 00:27:01 -0800, hugocoolens@gmail.com a écrit :


habib.bouaziz-viallet schreef:
Le Thu, 18 Jan 2007 01:48:39 -0800, hugocoolens@gmail.com a écrit :


habib.bouaziz-viallet schreef:
Le Wed, 17 Jan 2007 23:17:42 -0800, hugocoolens@gmail.com a écrit :

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

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 ...
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 <input.cir) and _not_ interactively
in command mode, I could write a little script to do all this
automatically. But as ngspice has it's own plot facility I would also
be happy if that could give me a nice plot.
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

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
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$
can you show me the contents of your test.cir?
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
regards,
hugo
 
Le Sat, 20 Jan 2007 08:11:01 -0800, hugocoolens@gmail.com a écrit :

habib.bouaziz-viallet schreef:
Le Fri, 19 Jan 2007 11:54:43 -0800, hugocoolens@gmail.com a écrit :


habib.bouaziz-viallet schreef:
Le Fri, 19 Jan 2007 00:27:01 -0800, hugocoolens@gmail.com a écrit :


habib.bouaziz-viallet schreef:
Le Thu, 18 Jan 2007 01:48:39 -0800, hugocoolens@gmail.com a écrit :


habib.bouaziz-viallet schreef:
Le Wed, 17 Jan 2007 23:17:42 -0800, hugocoolens@gmail.com a écrit :

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

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 ...
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 <input.cir) and _not_ interactively
in command mode, I could write a little script to do all this
automatically. But as ngspice has it's own plot facility I would also
be happy if that could give me a nice plot.
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

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
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$
can you show me the contents of your test.cir?
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
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
Hi Hugo,

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

Cheers, Habib
 
habib.bouaziz-viallet schreef:
Le Fri, 19 Jan 2007 11:54:43 -0800, hugocoolens@gmail.com a écrit :


habib.bouaziz-viallet schreef:
Le Fri, 19 Jan 2007 00:27:01 -0800, hugocoolens@gmail.com a écrit :


habib.bouaziz-viallet schreef:
Le Thu, 18 Jan 2007 01:48:39 -0800, hugocoolens@gmail.com a écrit :


habib.bouaziz-viallet schreef:
Le Wed, 17 Jan 2007 23:17:42 -0800, hugocoolens@gmail.com a écrit :

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

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 ...
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 <input.cir) and _not_ interactively
in command mode, I could write a little script to do all this
automatically. But as ngspice has it's own plot facility I would also
be happy if that could give me a nice plot.
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

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
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$
can you show me the contents of your test.cir?
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
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
 
habib.bouaziz-viallet schreef:
Le Sat, 20 Jan 2007 08:11:01 -0800, hugocoolens@gmail.com a écrit :


habib.bouaziz-viallet schreef:
Le Fri, 19 Jan 2007 11:54:43 -0800, hugocoolens@gmail.com a écrit :


habib.bouaziz-viallet schreef:
Le Fri, 19 Jan 2007 00:27:01 -0800, hugocoolens@gmail.com a écrit :


habib.bouaziz-viallet schreef:
Le Thu, 18 Jan 2007 01:48:39 -0800, hugocoolens@gmail.com a écrit :


habib.bouaziz-viallet schreef:
Le Wed, 17 Jan 2007 23:17:42 -0800, hugocoolens@gmail.com a écrit :

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

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 ...
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 <input.cir) and _not_ interactively
in command mode, I could write a little script to do all this
automatically. But as ngspice has it's own plot facility I would also
be happy if that could give me a nice plot.
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

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
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$
can you show me the contents of your test.cir?
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
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

Hi Hugo,

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

now it works perfectly, thank you very much Habib

hugo
 

Welcome to EDABoard.com

Sponsor

Back
Top