help-gsl
[Top][All Lists]

## Re: [Help-gsl] fitting - nonconstant point distance

 From: Petr Ent Subject: Re: [Help-gsl] fitting - nonconstant point distance Date: Sat, 25 Nov 2006 23:54:21 +0100 (CET)

hello, I am sorry for ambiguousity, I have been working on nonlinear least squares fitting (chapter 37). I have had deeper look in my english dictionary :) and I think I got the idea of the solver (actually it solves also my problem). When I fill f vector in function which is supposed to compute values of my model (expb_f in example), I insert only "residuals" (value of function with current parameters which are fitted minus values to which I fit ..... Yi - y[i] in example code). So solver does not care about how this value was computed or even according to which point it was computed, but it only cares how to minimize it. Basicly, it has only vector of numbers which it should make as small as possilbe. Am I right? So I can give him "residuals" in points for example 0, 100, 101 and 1048 and it should be ok....
```
Best Regards
Petr Ent

```
```On 25/11/06, Petr Ent <address@hidden> wrote:
> I would like to know if it is possible to fit points, which have nonconstant
distance
> (for example I know values in time 0,1,3,5,8,10,11). Is it possible to set
this
> somewhere?

What do you mean by "fit"? Do you want to interpolate or to regress?
What you want to do is possible in either case. If you want to
interpolate, look at chapter 26 of the GSL manual, and I recommend
studying the sample code in section 26.7 that can easily be adapted to
do something akin to what you want to do. For interpolation, you can
pass as a parameter an array to gsl_interp_init that gives the points
at which you know the value of your function.

If instead what you want to do is regression, look at chapters 36 and
37 of the GSL manual. Chapter 36 is for linear regression and 37 for
nonlinear regression.

HTH,
- Jordi G. H.

```
```

```