P. 1
Levenberg Examples

Levenberg Examples

|Views: 2|Likes:
Published by nazmul hasan

More info:

Published by: nazmul hasan on Sep 22, 2013
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

09/22/2013

pdf

text

original

Levenberg-Marquardt algorithm example The workbook "LM NLRegr 2dim examples.

xls" containing an example of bi-dimensional fitting with 4 parameters gaussian model.
2 f (x, c) = c4 ⋅ exp[−(c1 x12 + c2 x2 + c3 x1 x2 )]

derivatives of this model are:
∂f ∂c1 ∂f ∂c2 ∂f ∂c3 ∂f ∂c4
2 = −c4 ⋅ x12 ⋅ exp[−(c1 x12 + c2 x2 + c3 x1 x2 )] 2 2 = −c4 ⋅ x2 ⋅ exp[−(c1 x12 + c2 x2 + c3 x1 x2 )] 2 2 = −c4 ⋅ x1 x2 ⋅ exp[−(c1 x1 + c2 x2 + c3 x1 x2 )] 2 2 = exp[−(c1 x1 + c 2 x2 + c3 x1 x2 )]

The workbook contains the macro "fit" that uses the following modules (VBA project , Alt+F11) Lebenber_Marquart.bas contains the L-M algorithm (ver. 14.04.2006) Solve_Linear_Sistems.bas contains the linear system solver Interface.bas contains the routine calculating your function and its derivatives module.bas contains the macro example The Interface.bas is the "user" module. User must provide the function evaluation and its derivatives by the two routines: Sub Funct(f, c, x) and Sub DFunct(df, c, x).

The way on wich these values are calculated does not care to the L-M algorithm.. It is duty of user providing evaluation of f(x,c) and its derivatives with the best accuracy possible. Sometime the computing of exact derivatives are not easy. Therefore, user may prefer to approximate the derivatives by a numerical method. For this scope user must set the global variable Deriv_Approx = True. In that case the derivative will be approximated internally using the finite-difference central formula performed by Sub DFunctApprox(df, c, x). The test data set The test data set contains 10 points extracted from the function
2 y = 2 ⋅ exp[−( x12 − 0.7 x2 + 2.5 x1 x2 )]

x1

x2

y

809674836 1.1 0 0.4 0 0. 1] .616312274 1.3 0.3 -0.944776734 1.2 0.557601566 1.1 0.900557341 1.4 -0.1 0.548283938 1.585892247 1.1 0.-0.2 0.086701738 0.3 0. 0.5 -0.2 -0.2 0. 1.1 0.471301202 1.185101155 The starting values for the parameters may be: c = [1.5 1 1.3 0.

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->