Sha256: 6879c91c4706b8442128b1216ab9d7d3fff86bab3c23c29d6e0b62e5031931e1

Contents?: true

Size: 302 Bytes

Versions: 22

Compression:

Stored size: 302 Bytes

Contents

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

x = GSL::Vector[0.0, 0.3, 0.8, 1.1, 1.6, 2.3]
y = GSL::Vector[0.5, 0.82, 1.14, 1.25, 1.35, 1.40]
coef, cov, chisq, status = GSL::MultiFit.polyfit(x, y, 2)
p coef
x2 = GSL::Vector.linspace(0, 2.5, 20)
GSL::graph([x, y], [x2, coef.eval(x2)], "-C -g 3 -S 4 -X X -Y Y")

Version data entries

22 entries across 22 versions & 4 rubygems

Version Path
gsl-2.1.0.3 examples/fit/polyfit.rb
gsl-2.1.0.2 examples/fit/polyfit.rb
gsl-2.1.0.1 examples/fit/polyfit.rb
gsl-2.1.0 examples/fit/polyfit.rb
gsl-1.16.0.6 examples/fit/polyfit.rb
rb-gsl-1.16.0.5 examples/fit/polyfit.rb
rb-gsl-1.16.0.4 examples/fit/polyfit.rb
rb-gsl-1.16.0.3 examples/fit/polyfit.rb
rb-gsl-1.16.0.3.rc1 examples/fit/polyfit.rb
gsl-nmatrix-1.15.3.2 examples/fit/polyfit.rb
gsl-nmatrix-1.15.3.1 examples/fit/polyfit.rb
rb-gsl-1.16.0.2 examples/fit/polyfit.rb
rb-gsl-1.16.0.1 examples/fit/polyfit.rb
rb-gsl-1.16.0 examples/fit/polyfit.rb
rb-gsl-1.15.3.2 examples/fit/polyfit.rb
rb-gsl-1.15.3.1 examples/fit/polyfit.rb
blackwinter-gsl-1.15.3.2 examples/fit/polyfit.rb
gsl-nmatrix-1.15.3.0 examples/fit/polyfit.rb
gsl-1.15.3 examples/fit/polyfit.rb
gsl-1.14.7 examples/fit/polyfit.rb