rdoc - project - usage - statcvs - viewcvs

Gnucap-Ruby

Gnucap-Ruby is a Ruby binding to gnucap.

Download

Download available on project page

Documentation

Most of the documentation is in the source: rdoc

Example

This is an example of gnucap-ruby which uses rgplot to generate a gnuplot graph.


#!/usr/bin/env ruby -w

require 'gnucap'
require 'gnuplot'

gnucap = EDA::Gnucap.new("Bridge")
gnucap.buildcmd("v1 1 0 sin(0 15 60 0 0)")
gnucap.buildcmd("rload 2 3 10k")
gnucap.buildcmd("d1 1 2 mod1")
gnucap.buildcmd("d2 0 2 mod1")
gnucap.buildcmd("d3 3 1 mod1")
gnucap.buildcmd("d4 3 0 mod1")
gnucap.buildcmd(".model mod1 d")
gnucap.command("print tran v(2,3)")
plotdata = gnucap.analysis("tran .5m 25m")

Gnuplot.open do |gp|
    gp << "set out 'bridge2.png'\n"
    gp << "set term png size 320, 240\n"
    gp << "set label '#{plotdata.title}' at 0,0 "
    gp << "point lt 1 pt 2 ps 3 offset 2,-2\n"
    gp << plotdata.to_gplot
end