# LMFsolve.m: Levenberg-Marquardt-Fletcher algorithm for nonlinear least squares problems

- Downloads:
- Views:
- Rating:

The function LMFsolve.m serves for finding optimal solution of an overdetermined system of nonlinear equations in the least-squares sense. The standard Levenberg- Marquardt algorithm was modified by Fletcher and coded in FORTRAN many years ago. LMFsolve is its essentially shortened version implemented in MATLAB and complemented by setting iteration parameters as options. This part of the code has been strongly influenced by Duane Hanselman's function mmfsolve.m. Next to it, a finite difference approximation of Jacobian matrix is appended to it as a nested subfunction as well as a function for dispaying of intermediate results.

Calling of the function is rather simple:

[x,ssq,cnt] = LMFsolve(Equations,X0); % or

[x,ssq,cnt] = LMFsolve(Equations,X0,'Name',Value,...); % or

[x,ssq,cnt] = LMFsolve(Equations,X0,Options) % .

In all cases, the applied variables have the following meaning:

* Equations is a function name (string) or a handle defining a set of equations,

* X0 is vector of initial estimates of solutions,

* x is the least-squares solution,

* ssq is sum of squares of equation residuals,

* cnt is a number of iterations

In the first case of call, default values of options are used. The second form of call defines selected options as a set of Name/Value pairs. The last alternative simplifies the statement by introducing earlier defined structure Options of NameValue pairs.

Field names of the structure options are:

'Display' for control of iteration results,

'MaxIter' for setting maximum number of iterations,

'ScaleD' for defining diagonal matrix of scales,

'FunTol' for tolerance of final function values,

'XTol' for tolerance of final solution increments.

Example:

The general Rosenbrock's function has the form

f(x) = 100(x(2)-x(1)^2)^2 + (1-x(1))^2

Optimum solution gives f(x)=0 for x(1)=x(2)=1. Function f(x) can be expressed in the form

f(x) = f1(x)^2 + f2(x)^2, where f1(x) = 10(x(2)-x(1)^2) and f2(x) = 1-x(1).

Values of the functions f1(x) and f2(x) can be used as residuals.

LMFsolve finds the solution of this problem in 19 iterations. The more complicated problem sounds:

Find the least squares solution of the Rosenbrock valey inside a circle of the unit diameter centered at the origin. It is necessary to build third function, which is zero inside the circle and increasing outside it. This property has, say, the next penalty function:

f3(x) = sqrt(x(1)^2 + x(2)^2) - r, where r is a radius of the circle.

Its implementation using anonymous functions has the form

R = @(x) sqrt(x'*x)-.5; % A distance from the radius r=0.5

ros= @(x) [10*(x(2)-x(1)^2); 1-x(1); (R(x)>0)*R(x)*1000];

[x,ssq,cnt]=LMFsolve(ros,[-1.2,1],'Display',1,'MaxIter',50)

Solution: x = [0.4556; 0.2059], |x| = 0.5000

sum of squares: ssq = 0.2966,

number of iterations: cnt = 51.

Notes:

* Users with old MATLAB versions, which have no anonymous functions implemented, have to call LMFsolve with named function for residuals.

For above example it is

[x,ssq,cnt]=LMFsolve('rosen',[-1.2,1]);

where the function rosen.m is for the given problem of the form

function r = rosen(x)

% Rosenbrock's valey with a constraint R = sqrt(x(2)^2+x(1)^2)-.5;

% Residuals:

r = [10*(x(2)-x(1)^2) % first part

1-x(1) % second part

(R>0)*R*1000 % penalty

];

* The new version of the function LMFsolve is without erroneous part of analytical form of Jacobian matrix.

* The internal function printit.m has been replaced by the function of the same name taken from the more advanced function LMFnlsq (FEX Id 17534) because of much better form of output.

* An error causing an inclination of the previous version to instability has been removed. this step improved stability essentially, however, the a number of iterations increased, if the old version converged at all. However, much better behaviour has the full version of the Fletcher's algorithm, which is implemented in the function LMFnlsq (Id 17534).

* The old (unstable) version of the function is also inclided under the name LMFsolveOLD for those users who liked it.

Reference:

Fletcher, R., (1971): A Modified Marquardt Subroutine for Nonlinear Least Squares. Rpt. AERE-R 6799, Harwell

Free download from Shareware Connection - The function LMFsolve.m serves for finding optimal solution of an overdetermined system of nonlinear equations in the least-squares sense

**Publisher:**Miroslav Balda |

**License:**Freeware |

**Price:**0.00

**Version:**1.0 |

**Size:**10 KB |

**Platform:**Matlab, Scripts

**Released Date:**01-02-2013 |

**Rating:**0 |

**Title:**LMFsolve.m: Levenberg-Marquardt-Fletcher algorithm for nonlinear least squares problems

**Author Url:**http://www.mathworks.com

**Program Info Url:**http://www.mathworks.com

**Download Url:**http://www.mathworks.com/matlabcentral/fx_files/16063/4/LMFsolve.zip

LMFnlsq - Solution of nonlinear least squares - The function The LMFnlsq.m serves for finding optimal solution of an overdetermined system of nonlinear equations in the least-squares sense

Vector Aitken's delta-square accelerator - Let the result of an iterative process be a vector

Checking Matrix Elements - Function check.m may accelerate debugging of a program.

Multiple assignment - The function arg2vars serves for assigning of values from input argument(s) to variables declared in the output list in the place of the function calling.

Open and close a job - It is always good to have tools at disposal

SimpleTest

WordPress Auto Poster Plugin

Professional Simulink Audio Equalizer

PHP Print / Echo

Ends Smart Form

Output buffering, and how it can change your life

ScriptCase - PHP Code Generator

Advanced Istaller for Java

Wind Turbine Model

FORMfields - The PHP Framework

C to C++ Converter

C++ Compiler

RTFGen - the PHP RTF generator

Cumulative Mann-Kendall trend test

Affiliate Programs

Animation

Auctions

Audio Systems

Banner Rotation

Blog

Bulletin Boards & Forums

Business & Enterprise

Buttons

Calendars & Events

Charts & Graphs

Chat

Classified Ad Managers

Communication

Nonlinear Equations Graph

Types Nonlinear Equations Graph

Graph Nonlinear Function

Nonlinear Function Curve Fitting

Function Equations Graphing Programs

LMFnlsq - Solution of nonlinear least squares - The function The LMFnlsq.m serves for finding optimal solution of an overdetermined system of nonlinear equations in the least-squares sense

DMFitter ActiveX control - DMFitter ActiveX control allows you to add sophisticated regression analysis tools to your software in a few lines of code.

Data Master 2000 - Free software for automation of professional measurement systems, data acquisition, processing and analysis. Especially suitable for scientists who would like to make high-performance, precise measurements in the experimental physics.

Data Master 2003 - Programmable scientific and technical graphics optimized for automation of test and measurement systems and numerical data analysis. Provides extensible set of editing and calculation features and includes ActiveX-compatible scripting environment.

Motofit - Motofit co-refines Neutron and X-ray reflectometry data, using the Abeles matrix / Parratt recursion and least squares fitting (Genetic algorithm or Levenberg Marquardt). It works in the IGOR Pro environment (TM Wavemetrics).

Shareware Connection periodically updates pricing and software information of 'LMFsolve.m: Levenberg-Marquardt-Fletcher algorithm for nonlinear least squares problems' from company source 'Miroslav Balda' , so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using 'LMFsolve.m: Levenberg-Marquardt-Fletcher algorithm for nonlinear least squares problems' crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of LMFsolve.m: Levenberg-Marquardt-Fletcher algorithm for nonlinear least squares problems.

Safe In Cloud - It is quite difficult to find any computer users nowadays who do not need to use the web, for any purpose. Whether it is for education or entertainment, the web is your best resource. You also need to use various online services for banking, ...

PictBear - Nowadays, a majority of PC users resort to digital image editing once in a while. It may be required for retouching image captured in smart phones or for creating an album in Facebook. For some people, tinkering with digital images is a pastime ...

SlimCleaner - Nearly all PC users need to use various utilities to enhance performance of their laptop or desktop from time to time. Windows inbuilt utilities can serve the purpose but when you can find more capable third party apps at low or zero cost, why ...

Style Jukebox - No matter if you use a computer for personal needs or work in a networked setup, listening to music is commonplace. It is required for relaxation amidst work and nearly every user indulges in it. For music playback on PC, the WMP is not the only ...

KeePass Password Safe - Using password becomes mandatory for performing various online operations, at both home and workplace. For accessing email accounts, shopping online, making banking transactions and similar tasks it is necessary to use user ids and passwords ...

7-Data Recovery Suite Free Edition - When you are dealing with lots of data it may be necessary at times to recover deleted data. The data may be deleted by mistake or by someone else. In such instances, it becomes necessary to retrieve the deleted data. You need to use third party ...

360 Internet Security - Using a computer without having capable Security software installed is equivalent to sleeping with your house’s main door wide open. Whether you use a PC at home or manage a network of computers at the workplace, PC security suite has ...

EasyBrake - PC users often need to convert videos from various formats to other formats that suit their needs. As expected, there are hundreds of free and paid apps to accomplish such tasks nowadays. It is not mandatory that you will have to pay a high ...

Argente Utilities - You can find so many third party utilities that can be used to maintain a Windows based PC and extract maximum performance from it. While these tools offer better performance than Windows in-built utilities, the plethora of choices can make ...

Groovy Media Player - There is hardly any PC user who does not listen to music while working on PC or at leisure time. For media playback on Windows PC, there are so many apps. You can opt for default WMP that comes with the OS. However, there are several other third ...