#
# kihon8.rb
#   $Id: kihon8.rb,v 1.2 2000/11/18 19:03:33 keiko Exp $
#


require "narray"
require "numru/dcl"
include NumRu
include NMath


xmin = 1.0
xmax = 100.0
ymin = 1.0
ymax = 100.0


def bplot

  nmax = 50
  x = NArray.sfloat(nmax)
  y = NArray.sfloat(nmax)

  DCL::slpvpr(1)

#-- 一次関数 ----
  x.indgen(2.0, 2.0)
  y = x

  DCL::sgsplt(1)
  DCL::sgplu(x, y)

#-- 指数関数 ----
  y = exp(0.05*x)

  DCL::sgsplt(2)
  DCL::sgplu(x, y)

#-- 対数関数 ----
  y = 20.0 * log(x)

  DCL::sgsplt(3)
  DCL::sgplu(x, y)

#-- 文字列 ----
  DCL::sgstxs(0.02)
  DCL::sgtxu(30.0, 40.0, '(30,40)')

end


#-- graph ---
iws = (ARGV[0] || (puts ' WORKSTATION ID (I)  ? ;'; DCL::sgpwsn; gets)).to_i
DCL::sgopn iws

DCL::sglset('LCLIP', true)

DCL::sgfrm
#-- 直角一様座標(左上) ----
DCL::sgswnd(xmin, xmax, ymin, ymax)
DCL::sgsvpt(0.1, 0.4, 0.6, 0.9)
DCL::sgstrn(1)
DCL::sgstrf

bplot

#-- 片対数(y)座標(右上) ----
DCL::sgswnd(xmin, xmax, ymin, ymax)
DCL::sgsvpt(0.6, 0.9, 0.6, 0.9)
DCL::sgstrn(2)
DCL::sgstrf

bplot

#-- 片対数(x)座標(左下) ----
DCL::sgswnd(xmin, xmax, ymin, ymax)
DCL::sgsvpt(0.1, 0.4, 0.1, 0.4)
DCL::sgstrn(3)
DCL::sgstrf

bplot
      
#-- 対数座標(右下) ----
DCL::sgswnd(xmin, xmax, ymin, ymax)
DCL::sgsvpt(0.6, 0.9, 0.1, 0.4)
DCL::sgstrn(4)
DCL::sgstrf

bplot

DCL::sgcls



syntax highlighted by Code2HTML, v. 0.9.1