GSL::Histogram2d class

Class methods



Methods

























Pdf class




Example

#!/usr/bin/env ruby
require("gsl")

N = 10000
BINS = 100

rng = Rng.new(2)
h2 = Histogram2d.alloc(BINS, [-5, 5], BINS, [-8, 8])

sig1 = 1.0
sig2 = 2.0

for i in 0...N do
  r1 = rng.gaussian(sig1)
  r2 = rng.gaussian(sig2)
  h2.increment(r1, r2)
end

hx = h2.xproject
hy = h2.yproject
printf("%f %f %f %f\n", h2.xsigma, h2.ysigma, hx.sigma, hy.sigma)
GSL::graph(hx, hy, "-T X -C -g 3")

prev next

Reference index top