When I use LsqFit to loop some curve fitting, I come across some singular exceptions. Anyone could give me some guidance on this problem. My os is window 32. Thank you.
func(x, p) = 1 ./ (p[1]+p[2] * exp.(-p[3] * x ))
println(F_averaged_vi)
println(F_VarY)
# averaged_vi: [-3.15, -2.25, -1.95, -1.65, -1.35, -1.05, -0.75, -0.45, -0.15, 0.15, 0.45, 0.75, 1.05, 1.35, 1.65, 1.95, 2.55]
#F_VarY [0.1, 0.65, 0.88, 0.883333, 1.94286, 1.28, 0.766667, 1.36071, 1.65405, 2.425, 3.23333, 3.80286, 6.23333, 8.1375, 21.9, 1.3, 24.6]
p0 = [0.01, 0.5, 0.5]
fit = LsqFit.curve_fit(func, F_averaged_vi, F_VarY, p0, lower = [0.005,realmin(Float64),realmin(Float64)],
upper = [0.05,typemax(Float64),typemax(Float64)],maxIter=1000)
Result:
Base.LinAlg.SingularException(3)
Stacktrace:
[1] A_ldiv_B! at .\linalg\lu.jl:238 [inlined]
[2] \(::Base.LinAlg.LU{Float64,Array{Float64,2}}, ::Array{Float64,1}) at .\linalg\factorization.jl:48
[3] \(::Array{Float64,2}, ::Array{Float64,1}) at .\linalg\generic.jl:832
[4] macro expansion at C:\Users\wangfeng\.julia\v0.6\LsqFit\src\levenberg_marquardt.jl:111 [inlined]
[5] macro expansion at .\simdloop.jl:73 [inlined]
[6] #levenberg_marquardt#1(::Float64, ::Float64, ::Int32, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64, ::Bool, ::Array{Float64,1}, ::Array{Float64,1}, ::LsqFit.#levenberg_marquardt, ::LsqFit.#f#5{#func,Array{Float64,1},Array{Float64,1}}, ::Calculus.#g#5{LsqFit.#f#5{#func,Array{Float64,1},Array{Float64,1}},Symbol}, ::Array{Float64,1}) at C:\Users\wangfeng\.julia\v0.6\LsqFit\src\levenberg_marquardt.jl:110
[7] (::LsqFit.#kw##levenberg_marquardt)(::Array{Any,1}, ::LsqFit.#levenberg_marquardt, ::Function, ::Function, ::Array{Float64,1}) at .\<missing>:0
[8] #lmfit#2(::Array{Any,1}, ::Function, ::LsqFit.#f#5{#func,Array{Float64,1},Array{Float64,1}}, ::Calculus.#g#5{LsqFit.#f#5{#func,Array{Float64,1},Array{Float64,1}},Symbol}, ::Array{Float64,1}, ::Array{Float64,1}) at C:\Users\wangfeng\.julia\v0.6\LsqFit\src\curve_fit.jl:13
[9] (::LsqFit.#kw##lmfit)(::Array{Any,1}, ::LsqFit.#lmfit, ::Function, ::Function, ::Array{Float64,1}, ::Array{Float64,1}) at .\<missing>:0
[10] #lmfit#3(::Array{Any,1}, ::Function, ::Function, ::Array{Float64,1}, ::Array{Float64,1}) at C:\Users\wangfeng\.julia\v0.6\LsqFit\src\curve_fit.jl:38
[11] (::LsqFit.#kw##lmfit)(::Array{Any,1}, ::LsqFit.#lmfit, ::Function, ::Array{Float64,1}, ::Array{Float64,1}) at .\<missing>:0
[12] #curve_fit#4(::Array{Any,1}, ::Function, ::#func, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}) at C:\Users\wangfeng\.julia\v0.6\LsqFit\src\curve_fit.jl:45
[13] (::LsqFit.#kw##curve_fit)(::Array{Any,1}, ::LsqFit.#curve_fit, ::Function, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}) at .\<missing>:100:
My Julia Information
Julia Version 0.6.3
Commit d55cadc350* (2018-05-28 20:20 UTC)
Platform Info:
OS: Windows (i686-w64-mingw32)
CPU: Intel(R) Core(TM) i5-4300M CPU @ 2.60GHz
WORD_SIZE: 32
BLAS: libopenblas (DYNAMIC_ARCH NO_AFFINITY Nehalem)
LAPACK: libopenblas
LIBM: libopenlibm
LLVM: libLLVM-3.9.1 (ORCJIT, haswell)