Connect with us

How to plot pole zero results in ngspice

Discussion in 'CAD' started by [email protected], Jan 18, 2007.

Scroll to continue with content
  1. 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
    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
    correctly scaled axis but I can't distinguish the poles and zeroes on
    it. Is this possible with ngspice?


    here is the inputfile:
    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) dec 20 1m 10k
  2. Le Wed, 17 Jan 2007 23:17:42 -0800, 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 ...

  3. Guest

    habib.bouaziz-viallet schreef:
    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.

  4. Le Thu, 18 Jan 2007 01:48:39 -0800, a écrit :
    Ok then, I understand what are your needs ...
    I did this (mostly perfectible !)


    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
  5. Guest

    habib.bouaziz-viallet schreef:
    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

  6. Le Fri, 19 Jan 2007 00:27:01 -0800, a écrit :
    Hi Hugo, the shell-script above ( runs on my Debian, see what i
    have :

    [email protected]:~/GNU-TOOLS/ng-spice-rework-17/tests/polezero$ ./
    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
    0 pole(1) voltage
    1 pole(2) voltage
    2 zero(1) voltage
    0 -2.618033988749895e+00,0.000000000000000e+00

    [email protected]:~/GNU-TOOLS/ng-spice-rework-17/tests/polezero$
  7. Guest

    habib.bouaziz-viallet schreef:
    can you show me the contents of your test.cir?

  8. Le Fri, 19 Jan 2007 11:54:43 -0800, a écrit :
    Sure Hugo,

    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 dec 20 10m 10k


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

  9. Guest

    habib.bouaziz-viallet schreef:
    See what I get with the mentioned above and this test.cir:
    [email protected]:~/pald$ ./
    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
    ../ line 6: report_binary.out: command not found

    I think there is something wrong with the ngsconvert b

  10. Le Sat, 20 Jan 2007 08:11:01 -0800, a écrit :
    Hi Hugo,

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

    Cheers, Habib
  11. Guest

    habib.bouaziz-viallet schreef:
    now it works perfectly, thank you very much Habib

Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day