Options

It is possible to pass an optional set of parameters to the fitting functions with the options keyword, using an Options struct. For example:

using EasyFit, Random
Random.seed!(1)

x = sort(rand(10))
y = @. 0.3 * exp(5x)

fitexp(x, y, options=Options(maxtrials=1000))
------------ Single Exponential fit -----------

Equation: y = a exp(-x/b) + c

With: a = 0.30000000000004806
      b = -0.20000000000000756
      c = -1.3259722107151215e-13

Correlation coefficient, R² = 1.0
Average square residue = 1.0131306401237642e-26

Predicted Y: ypred = [ 0.3384085953157056, 0.383615820906023, ...]
residues = [ -7.993605777301127e-14, -7.471800955727304e-14, ...]

-----------------------------------------------

Available options:

KeywordTypeDefault valueMeaning
fineInt100Number of points of fit to smooth plot.
p0_rangeVector{Float64}[-100*(maximum(Y)-minimum(Y)), 100*(maximum(Y)-minimum(Y))]Range of generation of initial random parameters.
nbestInt5Number of repetitions of best solution in global search.
besttolFloat641e-4Similarity of the sum of residues of two solutions such that they are considered the same.
maxtrialsInt100Maximum number of trials in global search.
debugBoolfalsePrints errors of failed fits.

The nbest, besttol, and maxtrials options are also used by the multistart search performed by fitexpdecay (see Normalized exponential decay).