examples/fit/wlinear.rb in rb-gsl-1.16.0.4 vs examples/fit/wlinear.rb in rb-gsl-1.16.0.5
- old
+ new
@@ -8,11 +8,11 @@
c0, c1, cov00, cov01, cov11, chisq = GSL::Fit::wlinear(x, w, y)
printf("# best fit: Y = %g + %g X\n", c0, c1);
printf("# covariance matrix:\n");
-printf("# [ %g, %g\n# %g, %g]\n",
+printf("# [ %g, %g\n# %g, %g]\n",
cov00, cov01, cov01, cov11);
printf("# chisq = %g\n", chisq);
File.open("data.dat", "w") do |f|
for i in 0...n do
@@ -24,12 +24,12 @@
ffit = File.open("fit.dat", "w")
fhi = File.open("hi.dat", "w")
flo = File.open("lo.dat", "w")
for i in -30...130 do
xf = x[0] + (i/100.0) * (x[n-1] - x[0])
-
+
yf, yf_err = GSL::Fit::linear_est(xf, c0, c1, cov00, cov01, cov11)
-
+
ffit.printf("%g %g\n", xf, yf)
fhi.printf("%g %g\n", xf, yf + yf_err)
flo.printf("%g %g\n", xf, yf - yf_err)
end
ensure