How to use the array as the argument for curve-fit?

I wanna using curve-fit with an independent variable constituted by 4 float64 elements (Vector{Array{Float64,3} with 4 elements}.
However, It didn’t work and give the message as follows:
MethodError: no method matching isinf(::Array{Float64, 3})

The toy example is here:

A=rand(150,27,55) #element1
B=rand(1,1,55) #element2
C=rand(150,27) #element3
D=rand(200,3,55) #element4
IV=[A, B, C, D] #independent variable

function LSQFIT(para, IP)
                T=IP; #initial point
                A=IV[1]; B=IV[2]; C=IV[3]; Fv_D=IV[4];
end

fit=curve_fit(LSQFIT, IV, DV, IP)

Is there a way to use variable ‘IV’ as the argument of curve-fitting?

Where does the function curve_fit come from?

1 Like

I cited GitHub - JuliaNLSolvers/LsqFit.jl: Simple curve fitting in Julia. DV (dependent variable), IP (initial point), and return(output of the function) are omitted from the toy example because it seems not to relate to the argument type.

I’m not sure if I understood your question correctly.

Actually it would be better to include all of these variables, and package imports, so that people who try to help you can reproduce your errors :slight_smile:

1 Like