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

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 iterationsIn 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))^2Optimum 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.5000sum 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

Similar scripts

Rob Keyboard
(Popularity: ) : This plugin is produced for holding on keyboard when pairing program. You can type "shift ctrl K" to lock intellJ by a Dialog with amusing words. You can lock intellJ by password, with configging password enabled.At first, you should add ... CIE Coordinate Calculator
(Popularity: ) : This software is for calculating the CIE chromaticity co-ordinates of phosphor materials using the photo luminescence data. The software also shows the position of the co-ordinates in chromaticity diagram and expected color of the material. Please note that the color ... New Dream Coder for Oracle
(Popularity: ) : This tool is an code generator for Oracle. While fetching large tables this tool reduces usage of memory. Some features of this tool are, it has new password ecryption, procedure builder, session monitor, SQL templates etc., It increases execution times ... Foreign Exchange Options
(Popularity: ) : fxoptions( S0, X, rd, rf, T, vol, style)Valuation of European and American call and put options on foreign exchange using Garman-Kohlhagen model.European option prices are given by an exact formula (Garman-Kohlhagen).American option prices are approximated using both binomial and trinomial ... Anti Cut and Paste
(Popularity: ) : This utility is helpful for programmers that allows them to search programming language source code's text fragments which have been copied and pasted. Some key features of this tool are, this tool supports both command line and Graphical User Interface ... AC Protect Standard
(Popularity: ) : This utility is used for avoiding hackers from cracking your software using special techniques called anti crack. It works with all windows platforms. Some features of this tool are, this tool compresses ocx, scr, exe, dll and more, dynamic encrypt ... Bokai Barcode Image generator
(Popularity: ) : This tool is used for barcode generator and which has an ActiveX control for printing barcodes. This tool contains more than twenty five barcode types. This tool supports only ActiveX control programs. Users can customize barcode parameters and design of ... VBcodePrint
(Popularity: ) : This Add-In to Microsoft Visual Basic 6 significantly enhances its source code printing capabilities. You can print any part of your VB project's source code from within the VB's development environment. / You can create and save your own output ... Use Matlab Editor to Write and Run Ansys Program.
(Popularity: ) : You don't have to switch your screen between Matlab, Ansys and UltraEdit or PSPad anymore, when you doing FEM-Analysis.You can use MEditor to write your Ansys APDL program and use the excellent feature of MEditor to structure your Code: Cell-Function, ... VBAcodePrint
(Popularity: ) : This add-in enables you to print Microsoft VBA source code in color of your applications across the entire Microsoft Office 2000 suite of applications: Word, Excel, Outlook, Access, PowerPoint, and FrontPage and any other VBA enabled software. / You can ...

User reviews

Similar Software

dlib C++ library
(Popularity: ) : Dlib is a general purpose cross-platform C++ library designed using contract programming and modern C++ techniques. It is open source software and licensed under the Boost Software License. The introduction contains everything you need to know to get started using ... Regression Analysis - DataFitting
(Popularity: ) : DataFitting is a powerful statistical analysis program that performs linear and nonlinear regression analysis (i.e. curve fitting). DataFitting determines the values of parameters for an equation, whose form you specify, that cause the equation to best fit a set of ... DynaFit 4.04.061 Beta
(Popularity: ) : The DynaFit application was developed to perform nonlinear least-squares regression of chemical kinetic, enzyme kinetic, or ligand-receptor binding data. The experimental data can be either initial reaction velocities in dependence on the concentration of varied species (e.g., inhibitor concentration vs. ... CurveExpert Basic
(Popularity: ) : CurveExpert Basic is a comprehensive curve fitting system for Windows. XY data can be modelled using a toolbox of linear regression models, nonlinear regression models, interpolation, or splines. Over 30 models are built-in, but custom regression models may also be ... Dell OptiPlex 755 System BIOS A04 for XP
(Popularity: ) : Level of Importance: Urgent
Dell highly recommends applying this update as soon as possible. The update contains changes to improve the reliability and availability of your Dell system.

Fixes and Enhancements
1. Removed China (Sinosun) TPM support.
2. Resolved defect with the floppy IDE ... Dell OptiPlex 755 System BIOS A04 for Vista 32-Bit
(Popularity: ) : Level of Importance: Urgent
Dell highly recommends applying this update as soon as possible. The update contains changes to improve the reliability and availability of your Dell system.

Fixes and Enhancements
1. Removed China (Sinosun) TPM support.
2. Resolved defect with the floppy IDE ... Dell Latitude E6500 Notebook System BIOS A06 for Vista 64-Bit
(Popularity: ) : Level of Importance: Recommended
Dell recommends applying this update during your next scheduled update cycle. The update contains feature enhancements or changes that will help keep your system software current and compatible with other system modules (firmware, BIOS, drivers and software).

Fixes ... Dell OptiPlex 755 System BIOS A04 for Vista 64-Bit
(Popularity: ) : Level of Importance: Urgent
Dell highly recommends applying this update as soon as possible. The update contains changes to improve the reliability and availability of your Dell system.

Fixes and Enhancements
1. Removed China (Sinosun) TPM support.
2. Resolved defect with the floppy IDE ... Dell Latitude E6500 Notebook Latitude E6500 System BIOS A06 for XP
(Popularity: ) : Level of Importance: Recommended
Dell recommends applying this update during your next scheduled update cycle. The update contains feature enhancements or changes that will help keep your system software current and compatible with other system modules (firmware, BIOS, drivers and software).

Fixes ... Dell Latitude E6500 Notebook System BIOS A06 for Win7 32-Bit
(Popularity: ) : Level of Importance: Recommended
Dell recommends applying this update during your next scheduled update cycle. The update contains feature enhancements or changes that will help keep your system software current and compatible with other system modules (firmware, BIOS, drivers and software).