LMFnlsq  Solution of nonlinear least squares 1.0 
Date Added: August 23, 2013  Visits: 284 


The function The LMFnlsq.m serves for finding optimal solution of an overdetermined system of nonlinear equations in the leastsquares sense. The standard Levenberg Marquardt algorithm was modified by Fletcher and coded in FORTRAN many years ago (see the Reference). This version of LMFnlsq is its complete MATLAB implementation complemented by setting parameters of iterations as options. This part of the code has been strongly influenced by Duane Hanselman's function mmfsolve.m.Calling of the function is rather simple and is one of the following: LMFnlsq % for help output x = LMFnlsq(Eqns,X0); x = LMFnlsq(Eqns,X0); x = LMFnlsq(Eqns,X0); x = LMFnlsq(Eqns,X0,'Name',Value,...); x = LMFnlsq(Eqns,X0,Options); [x,ssq] = LMFnlsq(Eqns,...); [x,ssq,cnt] = LMFnlsq(Eqns,...); [x,ssq,cnt,nfJ] = LMFnlsq(Eqns,...); [x,ssq,cnt,nfJ,XY] = LMFnlsq(Eqns,...);In all cases, the applied variables have the following meaning:% Eqns is a function name or a handle defining a set of equations,% X0 is a vector of initial estimates of solutions,% x is the leastsquares solution,% ssq is sum of squares of equation residuals,% cnt is a number of iterations,% nfJ is a sum of calls of Eqns and function for Jacobian matrix,% xy is a matrix of iteration results for 2D problem [x(1), x(2)].% Options is a list of NameValue pairs, which may be set by the callsOptions = LMFnlsq; % for default values,Options = LMFnlsq('Name',Value,...); % for users' chosen parameters,Options = LMFnlsq(Options,'Name',Value,...); % for updating Options.If no Options is defined, default values of options are used.Field names 'Name' 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,% 'Trace' for control of iteration saving,% 'Lambda' for setting of initial value of the parameter lambda.% 'Jacobian' for a handle of function, which evaluates Jacobian matrix.If no handle is declared, internal function for finite difference approximation of the matrix is used.Example 1:The general Rosenbrock's function has the form f(x) = 100(x(2)x(1)^2)^2 + (1x(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) = 1x(1).Values of the functions f1(x) and f2(x) can be used as residuals. The parameter Eqns has a form of either named function:% function r = rosen(x)%% ROSEN Residuals of the Rosenbrock valey:% r = [ 10*(x(2)x(1)^2) % first part, f1(x)% 1x(1) % second part, f2(x)% ];or a handle of the anonymous function:% rosen = @(x) [10*(x(2)x(1)^2); 1x(1)];The calls are different:[x,...] = LMFnlsq('rosen',...); % in case of named function, or[x,...] = LMFnlsq(rosen,...); % in case of the function handle.LMFnlsq finds the exact solution of this problem in 17 iterations.Example 2:Regression of experimental data.Let us have experimental data simulated by the decaying function y = c(1) + c(2)*exp(c(3)*x) + w*randn(size(x));for column vector x. An initial guess of unknown parameters is obtained from approximation y(x) for x=0 and x>Inf asc1 = y(end);c2 = y(1)c(1); andc3=x(2:end1)log((y(2:end1)c1)/c2)The anonymous function is defined for predefined column vector x as res = @(c) c(1)+c(2)*exp(c(3)*x)  y;and the call, say [x,ssq,cnt] = LMFnlsq(res,[c1;c2;c3],'Display',1);Provided w=0 (without errors), x=(0:.1:2)' with c=[1,2,1], the initial estimates of unknown coefficients arec0 = [1.2707, 1.7293, 1.6226].The call [c,ssq,cnt] = LMFnlsq(res,[c1,c2,c3])gives the exact solution c=[1, 2, 1] in 9 iterations.Notes:* Users having old MATLAB versions earlier than 7, which has no anonymous functions implemented, have to call LMFnlsq with named functions for evaluation of residuals.* The new version also repairs a bug in using user's function for evaluation analytical jacobian matrix.* See LMFnlsqtest for a short explanation and solved examples.Reference:Fletcher, R., (1971): A Modified Marquardt Subroutine for Nonlinear Least Squares. Rpt. AERER 6799, Harwell

License: Freeware  Size: 870.4 KB 
Development Tools

LMFsolve.m: LevenbergMarquardtFletcher algorithm for nonlinear least squares problems 1.0
The function LMFsolve.m serves for finding optimal solution of an overdetermined system of nonlinear equations in the leastsquares sense. The standard Levenberg Marquardt algorithm was modified by Fletcher and coded in FORTRAN many years ago.... 
10 KB  
Development Editors

EPLF 1.0.5
The Electron Pair Localization Function (EPLF) helps to understand chemical bonding in molecular systems. This code uses a modified formulation which allows the exact calculation of the EPLF for usual wave functions (HF,KS,CAS,...) 
317.44 KB  
Mathematics

SLGallery 1.2
Math software is often bulky, overloaded with useless features and requires reading huge manual before attempting to use it. SLGallery is the unique probability distribution calculation toolbox featuring 11 continuous and 4 discrete functions.... 
489 KB  
Programming

Nasal 1.0
Nasal is a language that I wrote for use in a personal project. Ostensibly it was because I was frustrated with the dearth of smallbutcomplete embeddable scripting languages, but of course I really wrote it because it was fun. It is still... 
102.4 KB  
Libraries

Libeval 1.0.7
Libeval provides simple means of evaluating simple arithmetic expressions involving literal numeric values, variables and functions using the addition (+), subtraction (), multiplication (*), division (/), modulo division (), exponentiation (^),... 
27.65 KB  
Development Editors

Dll Export Finder 1.1.1
Dll Export Finder is a lightweight and useful utility that allows you to locate the DLL that includes an exported function or an API. Dll Export Finder finds functions exported by dll in a specified directory. This is the tool you need if you... 

Mathematics

Ruler and Compass 1. 7. 2001
Geometrical constructions with ruler and compass. Write a source file with a provided editor and see output of your construction. There is a stepbystep option to see all steps of a construction. Constructions of polyhedrons with many examples.... 
1.98 MB  
Network & Internet

Pyrenean DNSKong 1.34
What is DNSKong? DNSKong is a personal cachingonly psuedoDNS server. DNSKong only serves the localhost. No machine from the outside world will be able to use your DNSKong. It uses the file, named.txt as rules for matching... 
30.72 KB  
Business

RPN Turbo Calc 1.1.0.1
An RPN stack based Calculator and adding machine. It contains 8 landscape pages supporting : Annuities, Bonds, Cash Flow, Depreciation, Statistics, Probability and other Math  Trigonometry functions. One page supports user defined and NAMED... 
1024 KB  
Libraries

CAM::PDF::GS::NoText 1.07
CAM::PDF::GS::NoText is a PDF graphic state. SYNOPSIS use CAM::PDF; my $pdf = CAM::PDF>new($filename); my $contentTree = $pdf>getPageContentTree(4); my $gs = $contentTree>computeGS(1); This class is used to represent the graphic state... 
737.28 KB 
Scripts

Free Ecommerce website creator 1.2
Free Ecommerce website creator is a free PHP shop creating script. This allows you to put a online shop on your own website. Create your own free ecommerce website for Your Business. Create an online shop using easyGUI online shop creator. The... 
1.44 KB  
Scripts

MochiGames PHP Script ZDR 1.00
MochiGames PHP Script ZDR is web site, ready for use, for flash games. These flash games are downloaded automatically by "MochiGames PHP Script ZDR" from MochiGames media. The use of the games is free, you can use your own Mochi Publisher ID and... 
368.54 KB  
Scripts

Php Chat 2.0
Add a free php site, single signon and multiple skins, 100% free 1. Server Modes: The chat server has paid mode and free mode. If the free chat mode, a free chat room will be assigned to your website with your domain as the room name. 2.... 
938.87 KB  
Scripts

Nibbleblog 3.0.1
Nibbleblog it's a powerful engine for creation and manipulation of BLOG's completely free. Very simple to install and configure (Only 1 step). The database used is based on XML files and this way it is not necessary to use MySQL or similar DBMS.... 
371.09 KB  
Scripts

PHP File Manager  CloudOsys 2.9b8
CloudOsys is a PHP file manager, a tool that allows your visitors upload files such as media content directly to your website. Your visitors will upload files directly to your website, where they can share and comment on them. Through cloud... 
1.41 MB  
Development Tools

VMP Viewer 1.0
This is a very rudimentary tool to visualize the VMP files generated by BrainVoyager. Useful to share files with people who do not have BV. 
10 KB  
Development Tools

7Zip for Script 4.42
7Zip is a file archiver with a high compression ratio.Features: High compression ratio in new 7z format with LZMA compression Supported formats: Packing / unpacking: 7z, ZIP, GZIP, BZIP2 and TAR Unpacking only: RAR, CAB, ISO, ARJ, LZH, CHM,... 
624.64 KB  
Development Tools

PHP Docbook Displayer for Scripts 1.0b
PHP Docbook Displayer provides XSL and CSS stylesheets, and PHP scripts, to generate easily and dynamically websites from Docbook files.It aims at simplifying to the max the web publication process : simply drop the docbook file under the site root ! 
102.4 KB  
Development Tools

WP Translate 1.0
This simple language translation plugin allows your users to quickly translate your webpages, through a widget on your blog.You have the option to select the title of the Widget, which will be displayed above the language translation form. Users... 
10 KB  
Development Tools

save2word 1.0
A simple function to copy figure from MATLAB into MS Word automatically. It is a modification of saveppt (a function in File exchange) that save figures to MS Powerpoint. 
10 KB 