James Bergstra wrote: > On Sat, Jul 08, 2006 at 08:43:54AM +0200, Petr Ent wrote: > >> hi, >> i am pretty new user of gsl, so please sory for this question... >> what is the easiest\fastest way to fit few points with an exponential >> function? i found example of non-linear least squares fitting, but it seems >> bit slow and difficult way to me. could this fitting be done with linear >> fitting? >> > > Maybe naive... but... take the log of your points and do a linear fit? > > James > This may be a better approach. Roughly if you have points (x_1, y_1),..., (x_n,y_n) and do a least squares fit on (x_1,log(y_1)),..., (x_n,...,log(y_n)) to get coefficients a and b giving
log( y ) = ax + b, Then the exponential fit is given by y = A exp( bx ) where A = exp( a ) (a constant). This does depend on the usual linear regression assumptions. You'd usually check these with a statistical package such as R or SPSS. In particular, you probably want to check for homoskedasticity. -- JDL _______________________________________________ Help-gsl mailing list Help-gsl@gnu.org http://lists.gnu.org/mailman/listinfo/help-gsl