help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] Linear fitting


From: Patrick Alken
Subject: Re: [Help-gsl] Linear fitting
Date: Thu, 3 May 2018 10:47:56 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

Francisco,

  You have some errors in the way you handle your 2D arrays. I have made a small modification to define new 1D arrays (x and y) and store your fit data into those arrays. The program output now says:

Performing fit with 20 points...done! (status = 0)
====== BET results ======
y = 0.000022 + 0.005321 x
[2.54531e-11, -1.26944e-10
 -1.26944e-10, 8.07463e-10]
Chi Square = 0.000000
=========================

My changes are attached - you can find the lines I changed with the "PA" keyword

On 05/03/2018 04:13 AM, Francisco M Neto wrote:
Greetings!

        I have been trying to use gsl for some linear least squares
fitting, but for some reason I'm getting bad results.

        Instead of returning the results of the fit, gsl_fit_linear()
returns -nan for all parameters. I'm not sure if I'm passing something
wrong to it, but I do know that there is no problem with the data (I've
ran it through other LS fitting procedures and results are consistent).

        Attached are the source and an example data file. I've compiled
and ran with:

$ gcc -I/usr/include/gsl/ -lm -lgsl -lgslcblas -o teste_bet teste_bet.c

$ ./teste_bet data.dat


Attachment: teste_bet.c
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]