Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News Sign UpSign In
| Download
Views: 60
Kernel: Octave
pkg load optim %pkg load data-smoothing %pkg list
%%%help nlinfit
function y=fitfun1(c,x) y=c(1)*x+c(2); end
fitfun1([1 2],3)
ans = 5
x=1:10; y=3*x+2; c0=[2 1]; cf=nlinfit(x,y,@fitfun1,c0)
cf = 3.0000 2.0000
function y=fitfun2(c,x) y=c(1)*exp(-x*c(2)); end
x=0:0.01:3; y=3*exp(-x*0.1); c0=[2 0.5]; cf=nlinfit(x,y,@fitfun2,c0)
cf = 3.000000 0.100000
%help nonlin_curvefit %http://octavegsoc15.blogspot.com/ %https://github.com/AsmaAfzal/octave_workspace %https://octave.sourceforge.io/optim/overview.html %https://fossies.org/windows/misc/octave-4.2.1-w32.zip/octave-4.2.1/share/octave/packages/optim-1.5.2/doc/optim.texi
'nonlin_curvefit' is a function from the file /usr/local/share/octave/packages/optim-1.5.2/nonlin_curvefit.m -- Function File: [P, FY, CVG, OUTP] = nonlin_curvefit (F, PIN, X, Y) -- Function File: [P, FY, CVG, OUTP] = nonlin_curvefit (F, PIN, X, Y, SETTINGS) Frontend for nonlinear fitting of values, computed by a model function, to observed values. Please refer to the description of 'nonlin_residmin'. The differences to 'nonlin_residmin' are the additional arguments X (independent values, mostly, but not necessarily, an array of the same dimensions or the same number of rows as Y) and Y (array of observations), the returned value FY (final guess for observed values) instead of RESID, that the model function has a second obligatory argument which will be set to X and is supposed to return guesses for the observations (with the same dimensions), and that the possibly user-supplied function for the jacobian of the model function has also a second obligatory argument which will be set to X. Also, if the setting 'user_interaction' is given, additional information is passed to these functions. Type 'optim_doc ("Common optimization options")' for this setting. See also: nonlin_residmin. Additional help for built-in functions and operators is available in the online version of the manual. Use the command 'doc <topic>' to search the manual index. Help and information about Octave is also available on the WWW at http://www.octave.org and via the [email protected] mailing list.