lmfit-general Mailing List for lmfit - least squares fitting
Levenberg-Marquardt least squares minimization amd curve fitting.
Brought to you by:
jwuttke
You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2006 |
Jan
(3) |
Feb
|
Mar
(4) |
Apr
|
May
(4) |
Jun
|
Jul
|
Aug
(4) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2007 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
1
|
2
|
3
|
4
|
5
|
6
|
|
7
|
8
|
9
|
10
|
11
|
12
|
13
|
|
14
|
15
|
16
|
17
(1) |
18
(3) |
19
|
20
|
|
21
|
22
|
23
|
24
|
25
|
26
|
27
|
|
28
|
29
|
30
|
31
|
|
|
|
|
From: Joachim W. <wu...@we...> - 2006-05-18 08:34:47
|
> what would be considered a "good" starting value=20
I have no other criterion to offer than common sense & experience: plot yo=
ur
data and your starting curve; if their qualitative features (extreme point=
s,
bending points, asymptotes - just the =BBKurvendiskussion=AB stuff) agree, the=
re
is a good chance that the curve will converge towards the data points
> and how could such a value be generated in a generalized manner
for instance, if you are fitting a Gaussian distribution: determine the
center-of-gravity, the width and the height of the distribution from weigh=
ted
sums over your data points.
> I tried fabs(p[1])
good idea
> and sqr(p[1])
even a better idea, provided you really mean sqr and not sqrt
(but why do you use the ugly pow(..,2.0) if you have a sqr function=3F)
> FitFunction4( double t, double* p)
> {
>=20
> double deltax =3D (t-p[0])*(t-p[0]);
>=20
> double dFWHM =3D dHalbwertsbreite;
>=20
> double omega =3D pow(dFWHM/TWOTIMESROOTLN2 , 2.0);
>=20
> return ( p[1]* exp(-deltax/omega) + p[2] ); // Ansatz =FCber Position Gaus=
s
>=20
> }
why don't you leave your Halbwertsbreite free -> yet another fit parameter=
Hope this helps. Otherwise: you may also hire me for consultancy.
Two hours discussion with a data analysis expert may save you
days of deadlock.
Kind regards, Joachim
=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F
SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
kostenguenstig. Jetzt gleich testen! http://f.web.de/=3Fmc=3D021192
|
|
From: Nandini H. <nh...@he...> - 2006-05-18 07:15:14
|
Dear Joachim,
what would be considered a "good" starting value - and how could such a
value be generated in a generalized manner ?
At the moment I generate three such values which lie more or less around the
required optimum for a gauss function but the
implementation sometimes seems to generate negative amplitudes for a
function of the form specified below. I plotted the initial
points as well as the fit results and found that the deviation was way too
large - it couldn't possiby have approximated the required
curve in the least squares sense. Is there any way of restricting the search
to positiove amplitudes ? I tried fabs(p[1]) and sqr(p[1])
but that didn't seem to work for my case.
FitFunction4( double t, double* p)
{
double deltax = (t-p[0])*(t-p[0]);
double dFWHM = dHalbwertsbreite;
double omega = pow(dFWHM/TWOTIMESROOTLN2 , 2.0);
return ( p[1]* exp(-deltax/omega) + p[2] ); // Ansatz über Position Gauss
}
Any suggestions ?
Regards,
Nandini
----- Original Message -----
From: "Joachim Wuttke" <wu...@we...>
To: <lmf...@li...>; "Nandini Hengen"
<nh...@he...>
Sent: Thursday, May 18, 2006 8:57 AM
Subject: Re: [Lmfit-general] Fitting Periodic Functions using
Levenberg-Marquardt's method
> Dear Nandini,
>
> there is no reason why a fit function ought to be periodic.
>
> Try to track down your problem to one of the following:
> - bad starting values -> did you visualise the initial function before
starting to fit?
> - overflow or underflow in exp
>
> Good luck, Joachim
> _______________________________________________________________
> SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
> kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192
>
|
|
From: Joachim W. <wu...@we...> - 2006-05-18 06:57:23
|
Dear Nandini, there is no reason why a fit function ought to be periodic. Try to track down your problem to one of the following: - bad starting values -> did you visualise the initial function before starting to fit? - overflow or underflow in exp Good luck, Joachim _______________________________________________________________ SMS schreiben mit WEB.DE FreeMail - einfach, schnell und kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192 |
|
From: Nandini H. <nh...@he...> - 2006-05-17 22:33:32
|
Hi, the implementation seems to work for nonlinear functions of the form = A*sine(B) + C, cosine etc. but fails for functions like exp etc. which = are nonperiodic. Do the relevant functions have to be specified as = periodic (repetitive) form to ensure convergence ? Any help is appreciated. Regards, Nandini |