5.0

5.0 | 1 rating Rate this file 30 Downloads (last 30 days) File Size: 210 KB File ID: #39564
image thumbnail

LMFnlsq2

by Miroslav Balda

 

21 Dec 2012 (Updated 23 Apr 2013)

Solution of one or more nonlinear equations in the least squares sense.

| Watch this File

File Information
Description

The function is an improved version of the function LMFnlsq widely tested on the nonlinear regression, curve fitting and identification problems. Better description is in the complementing file LMFnlsq2test.pdf.

Warning: The option 'Display' is changed for better control of intermediate results output. See help LMFnlsq2.

Required Products MATLAB
MATLAB release MATLAB 7.3 (R2006b)
Other requirements The demo program LMFnlsq2test needs functions inp, fig, separator and LMFnlsq2 from File Exchange
Tags for This File  
Everyone's Tags
curve fitting, identification, measurement, nonlinear least squares, optimization
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (5)
02 Apr 2013 Jose

what is the use of Basdx if it is not used
plus it takes the value 0.25*xf.Xtol so Xtol should be enough
and in the comments it should be 25e-9 ???

02 Apr 2013 Jose

actually LMFnlsqtest.m should have all the LMFnlsq replaced with LMFnlsq2

LMFnlsq.m:
line 191 xf.Basdx = 0.25*xf.Xtol;
should be xf.Basdx = 0.25*xf.XTol;

02 Apr 2013 Jose

LMFnlsqtest.m on line 29 should be:
if ~exist('LMFnlsq2.m','file'), Id = [Id 'LMFnlsq2 (Id=39564 )']; end

01 Apr 2013 Jose

Line 286, it should be elseif lb~=n

elseif le~=n
error(['Dimensions of vector dx ',num2str(lb),'~=',num2str(lx)]);
end

01 Apr 2013 Jose

Lines 301 and 311 do the same, one should be enough:

SS = r'*r;

feval(printf,ipr,-1); % Table header
dx = zeros(n,1);
res= 1;
cnt=0;
feval(printf,ipr,cnt,res,SS,x,dx,l,lc) % Initial state

[A,v] = getAv(FUN,JAC,x,r,bdx);
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SS = r'*r;

Updates
15 Apr 2013

Display of intermediate results has been improved to fulfill better users' requirements.

Thanks Jose's detailed study of the code, small bugs were repaired and the code made more clear.

16 Apr 2013

Repaired several bugs found by Jose. Improved description of the function and of the demo program LMFnlsq2test.

22 Apr 2013

The new version of the function is a slight modification of the recent update. One statement, dated 2012-12-01, has been commented out because of its erroneous function under certain circumstances. The function is now fast and much more stable.

23 Apr 2013

Improved the printout of results. The previous versions did not display the final solution if the iteration count were not integer multiple of required step of printing.

Contact us