Sha256: 94feec9ca4d3e868fa0acd5daa63d123bd92e65b1d7cbf9b31a0bd88c74348f1

Contents?: true

Size: 354 Bytes

Versions: 16

Compression:

Stored size: 354 Bytes

Contents

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

N = 10000
rng = GSL::Rng.alloc
data = rng.gamma(2, 1.5, N)
h = GSL::Histogram.alloc(100, [0, 15])
h.fill(data)
p h.bin

#result = h.fit_exponential
result = h.fit("xexp")
b = result[0]
amp = result[1]
p amp
p 1.0/b
x = GSL::Vector.linspace(0, 15, 100)
y = amp*x*GSL::Sf::exp(-x*b)
GSL::graph(h, [x, y], "-C -g 3")

  

Version data entries

16 entries across 16 versions & 4 rubygems

Version Path
rb-gsl-1.16.0.4 examples/histogram/xexp.rb
rb-gsl-1.16.0.3 examples/histogram/xexp.rb
rb-gsl-1.16.0.3.rc1 examples/histogram/xexp.rb
gsl-nmatrix-1.15.3.2 examples/histogram/xexp.rb
gsl-nmatrix-1.15.3.1 examples/histogram/xexp.rb
rb-gsl-1.16.0.2 examples/histogram/xexp.rb
rb-gsl-1.16.0.1 examples/histogram/xexp.rb
rb-gsl-1.16.0 examples/histogram/xexp.rb
rb-gsl-1.15.3.2 examples/histogram/xexp.rb
rb-gsl-1.15.3.1 examples/histogram/xexp.rb
blackwinter-gsl-1.15.3.2 examples/histogram/xexp.rb
gsl-nmatrix-1.15.3.0 examples/histogram/xexp.rb
gsl-1.15.3 examples/histogram/xexp.rb
gsl-1.14.7 examples/histogram/xexp.rb
gsl-1.14.6 examples/histogram/xexp.rb
gsl-1.14.5 examples/histogram/xexp.rb