Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) Standard preamble: ========================================================================..
..
..
Set up some character translations and predefined strings. \*(-- will give an unbreakable dash, \*(PI will give pi, \*(L" will give a left double quote, and \*(R" will give a right double quote. \*(C+ will give a nicer C++. Capital omega is used to do unbreakable dashes and therefore won't be available. \*(C` and \*(C' expand to `' in nroff, nothing in troff, for use with C<>..tr \(*W-
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
Escape single quotes in literal strings from groff's Unicode transform. If the F register is turned on, we'll generate index entries on stderr for titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index entries marked with X<> in POD. Of course, you'll have to process the output yourself in some meaningful fashion. Avoid warning from groff about undefined register 'F'...
.nr rF 0
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). Fear. Run. Save yourself. No user-serviceable parts.. \" fudge factors for nroff and troff
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #]
.\}
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
. \" corrections for vroff
. \" for low resolution devices (crt and lpr)
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
======================================================================== Title "lmcurve 3" lmcurve 3 "2015-11-27" "perl v5.20.2" "lmfit manual"
For nroff, turn off justification. Always turn off hyphenation; it makes way too many mistakes in technical documents..nh
"NAME"
lmcurve - Levenberg-Marquardt least-squares fit of a curve (t,y)
"SYNOPSIS"
Header "SYNOPSIS" \fB#include <
lmcurve.h>
\fBvoid lmcurve( const int n_par, double *par, const int m_dat,
const double *t, const double *y,
double (*f)( const double ti, const double *par ),
const lm_control_struct *control,
lm_status_struct *status);
\fBvoid lmcurve_tyd(
const int n_par, double *par, const int m_dat,
const double *t, const double *y, const double *dy,
double (*f)( const double ti, const double *par ),
const lm_control_struct *control,
lm_status_struct *status);
\fBextern const lm_control_struct lm_control_double;
\fBextern const lm_control_struct lm_control_float;
\fBextern const char *lm_infmsg[];
\fBextern const char *lm_shortmsg[];
"DESCRIPTION"
Header "DESCRIPTION" \fB\f(BIlmcurve()
and
\f(BIlmcurve_tyd() wrap the more generic minimization function \f(BIlmmin(), for use in curve fitting.
\fB\f(BIlmcurve() determines a vector par that minimizes the sum of squared elements of a residue vector r[i] := y[i] - f(t[i];par). Typically, \f(BIlmcurve() is used to approximate a data set t,y by a parametric function f(ti;par). On success, par represents a local minimum, not necessarily a global one; it may depend on its starting value.
\fB\f(BIlmcurve_tyd() does the same for a data set t,y,dy, where dy represents the standard deviation of empirical data y. Residues are computed as r[i] := (y[i] - f(t[i];par))/dy[i]. Users must ensure that all dy[i] are positive.
Function arguments:
"n_par" 4
Item "n_par" Number of free variables.
Length of parameter vector par.
"par" 4
Item "par" Parameter vector.
On input, it must contain a reasonable guess.
On output, it contains the solution found to minimize ||r||.
"m_dat" 4
Item "m_dat" Number of data points.
Length of vectors t and y.
Must statisfy n_par <= m_dat.
"t" 4
Item "t" Array of length m_dat.
Contains the abcissae (time, or \*(L"x\*(R") for which function f will be evaluated.
"y" 4
Item "y" Array of length m_dat.
Contains the ordinate values that shall be fitted.
"dy" 4
Item "dy" Only in \f(BIlmcurve_tyd().
Array of length m_dat.
Contains the standard deviations of the values y.
"f" 4
Item "f" A user-supplied parametric function f(ti;par).
"control" 4
Item "control" Parameter collection for tuning the fit procedure.
In most cases, the default &lm_control_double is adequate.
If f is only computed with single-precision accuracy,
\fI&lm_control_float should be used.
Parameters are explained in \f(BIlmmin\|(3).
"status" 4
Item "status" A record used to return information about the minimization process:
For details, see \f(BIlmmin\|(3).
"EXAMPLE"
Header "EXAMPLE" Fit a data set y(x) by a curve f(x;p):
.Vb 2
#include "lmcurve.h"
#include <stdio.h>
\&
/* model function: a parabola */
\&
double f( double t, const double *p )
{
return p[0] + p[1]*t + p[2]*t*t;
}
\&
int main()
{
int n = 3; /* number of parameters in model function f */
double par[3] = { 100, 0, -10 }; /* really bad starting value */
\&
/* data points: a slightly distorted standard parabola */
int m = 9;
int i;
double t[9] = { -4., -3., -2., -1., 0., 1., 2., 3., 4. };
double y[9] = { 16.6, 9.9, 4.4, 1.1, 0., 1.1, 4.2, 9.3, 16.4 };
\&
lm_control_struct control = lm_control_double;
lm_status_struct status;
control.verbosity = 7;
\&
printf( "Fitting ...\en" );
lmcurve( n, par, m, t, y, f, &control, &status );
\&
printf( "Results:\en" );
printf( "status after %d function evaluations:\en %s\en",
status.nfev, lm_infmsg[status.outcome] );
\&
printf("obtained parameters:\en");
for ( i = 0; i < n; ++i)
printf(" par[%i] = %12g\en", i, par[i]);
printf("obtained norm:\en %12g\en", status.fnorm );
\&
printf("fitting data as follows:\en");
for ( i = 0; i < m; ++i)
printf( " t[%2d]=%4g y=%6g fit=%10g residue=%12g\en",
i, t[i], y[i], f(t[i],par), y[i] - f(t[i],par) );
\&
return 0;
}
.Ve
"COPYING"
Header "COPYING" Copyright (C) 2009-2015 Joachim Wuttke, Forschungszentrum Juelich GmbH
Software: FreeBSD License
Documentation: Creative Commons Attribution Share Alike
"SEE ALSO"
Header "SEE ALSO" lmmin(3)
Homepage: http://apps.jcns.fz-juelich.de/lmfit
"BUGS"
Header "BUGS" Please send bug reports and suggestions to the author <j.wuttke@fz-juelich.de>.