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

    Habib
     
  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.

    regards,
    hugo
     
  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 !)

    #!/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
     
  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

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

    [email protected]:~/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

    [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?

    regards,
    hugo
     
  8. Le Fri, 19 Jan 2007 11:54:43 -0800, a écrit :
    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
     
  9. Guest

    habib.bouaziz-viallet schreef:
    See what I get with the run.sh mentioned above and this test.cir:
    [email protected]:~/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
     
  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
    run.sh.

    Cheers, Habib
     
  11. Guest

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

    hugo
     
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

-