So as not to confuse others I just wanted to clarify that curve_fit does 
not care what you supply as x as long as what is returned from calling your 
model is a vector of same length as what you supply as y. Example:

using LsqFit

mvmodel(x, p) = begin
  n = abs(x[1,:]) .^ p[2]
  d = abs(x[2,:]) .^ p[3]
  (p[1] .* (n ./ d))[:]
end

N = 25
M = 100
X = randn(M, N)
Params = [1.0, 2.0, 2.0]
errors = 0.01*randn(N)
Y = mvmodel(X, Params) .+ errors

# curve_fit does not care about what is in X as long as what is returned
# when calling model(X, p) is vector of float of same size as Y.
fit = curve_fit(mvmodel, X, Y, rand(3))

julia> Params .- fit.param
3-element Array{Float64,1}:
  1.91519e-5
 -3.94951e-7
 -5.9904e-6

Reply via email to