# Fitting parameters of the model against data

**URL:** <https://discourse.julialang.org/t/fitting-parameters-of-the-model-against-data/84530>\
**Category:** New to Julia\
**Tags:** curve-fitting\
**Created:** [July 20, 2022, 11:44am UTC](https://discourse.julialang.org/t/fitting-parameters-of-the-model-against-data/84530 "2022-07-20T11:44:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Curio\_math](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/curio_math/32/32981_2.png) [@Curio\_math](https://discourse.julialang.org/u/Curio_math)\
**Post date:** [July 20, 2022, 11:44am UTC](https://discourse.julialang.org/t/fitting-parameters-of-the-model-against-data/84530/1 "2022-07-20T11:44:59Z")

</div>

Hi,  
I have to fit parameters of my model against the data I have. My model equation is of the form,

z = a_x / (b_y - c)

where a, b, c are the parameters and x, y, z forms variables.

Is that possible to fit the optimal parameter values if I have the data of x, y and z, in Julia? And using what packages?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![acxz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/acxz/32/16759_2.png) [@acxz](https://discourse.julialang.org/u/acxz)\
**Post date:** [July 20, 2022, 12:36pm UTC](https://discourse.julialang.org/t/fitting-parameters-of-the-model-against-data/84530/2 "2022-07-20T12:36:27Z")

</div>

One of the most fundamental types of fitting algorithms you can start off with is nonlinear least squares. Take a look at [GitHub - pjabardo/CurveFit.jl: Simple least squares and curve fitting functions](https://github.com/pjabardo/CurveFit.jl) which has an implementation you can use.

Edit: I recommend [GitHub - JuliaNLSolvers/LsqFit.jl: Simple curve fitting in Julia](https://github.com/JuliaNLSolvers/LsqFit.jl) over CurveFit.jl. Thanks for the suggestion @sylvaticus

---

<div class="post-metadata">

**Author:** ![Curio\_math](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/curio_math/32/32981_2.png) [@Curio\_math](https://discourse.julialang.org/u/Curio_math)\
**Post date:** [July 20, 2022, 12:38pm UTC](https://discourse.julialang.org/t/fitting-parameters-of-the-model-against-data/84530/3 "2022-07-20T12:38:50Z")

</div>

Thanks for the suggestion. Will check it out.

---

<div class="post-metadata">

**Author:** ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Post date:** [July 22, 2022, 2:30pm UTC](https://discourse.julialang.org/t/fitting-parameters-of-the-model-against-data/84530/4 "2022-07-22T14:30:04Z")

</div>

Or the same kind of package, but perhaps more used: [LsqFit.jl](https://github.com/JuliaNLSolvers/LsqFit.jl)
