Created
May 12, 2016 15:29
-
-
Save bjarthur/9c818bba8b4a74eb07f40f879e6c2df8 to your computer and use it in GitHub Desktop.
curve_fit in Optim.jl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Optim.jl 0.4.5+ throws an error: | |
julia> model(x,p) = p[1].*exp(-x./p[2])+p[3] | |
model (generic function with 1 method) | |
julia> x | |
40-element Array{Int64,1}: | |
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | |
21 | |
22 | |
23 | |
24 | |
25 | |
26 | |
27 | |
28 | |
29 | |
30 | |
31 | |
32 | |
143 | |
144 | |
145 | |
146 | |
147 | |
148 | |
149 | |
150 | |
julia> y | |
40-element Array{UInt16,1}: | |
0x0d71 | |
0x0b49 | |
0x0e62 | |
0x0b6a | |
0x0946 | |
0x0d4f | |
0x0773 | |
0x083a | |
0x102b | |
0x0b5d | |
0x0cb3 | |
0x0a0e | |
0x0b3f | |
0x0e1b | |
0x0d8a | |
0x0c19 | |
0x0b54 | |
0x0d3b | |
0x0d92 | |
0x0b8a | |
0x0cd0 | |
0x0b0e | |
0x08e4 | |
0x0e3a | |
0x0d97 | |
0x0b76 | |
0x0bac | |
0x091b | |
0x0b65 | |
0x0bd3 | |
0x0937 | |
0x0b26 | |
0x05dd | |
0x07af | |
0x056d | |
0x061b | |
0x07a2 | |
0x0541 | |
0x05fb | |
0x047e | |
julia> p | |
3-element Array{Float64,1}: | |
2291.0 | |
150.0 | |
1150.0 | |
julia> curve_fit(model,x,y,p) | |
ERROR: Base.LinAlg.SingularException(3) | |
in \ at linalg/factorization.jl:25 | |
in \ at linalg/dense.jl:448 | |
in levenberg_marquardt at /home/arthurb/.julia/v0.4/Optim/src/levenberg_marquardt.jl:84 | |
in lmfit at /home/arthurb/.julia/v0.4/LsqFit/src/curve_fit.jl:29 | |
in curve_fit at /home/arthurb/.julia/v0.4/LsqFit/src/curve_fit.jl:39 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment