# Choose a tool for curve fitting out of all available

**URL:** <https://discourse.julialang.org/t/choose-a-tool-for-curve-fitting-out-of-all-available/44202>\
**Category:** New to Julia\
**Tags:** package, machine-learning, curve-fitting\
**Created:** [August 3, 2020, 4:34pm UTC](https://discourse.julialang.org/t/choose-a-tool-for-curve-fitting-out-of-all-available/44202 "2020-08-03T16:34:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nandoconde](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nandoconde/32/19497_2.png) [@nandoconde](https://discourse.julialang.org/u/nandoconde)\
**Post date:** [August 3, 2020, 4:34pm UTC](https://discourse.julialang.org/t/choose-a-tool-for-curve-fitting-out-of-all-available/44202/1 "2020-08-03T16:34:56Z")

</div>

Hello!

I’m relatively new to Julia. This year I saw the JuliaCon and I’m trying to use it for my Master Thesis. I need to fit data from a simulation to a [Foster series](https://en.wikipedia.org/wiki/Foster%27s_reactance_theorem) but I can’t really choose the best tool available in Julia to do so.

In the one hand, I have thought of training a _neural network_ with ‘artificial data’ (generated by me) so that when I fed it with the data from the simulation it could extract the coefficients and constants of the series that fit the curve.

On the other hand, maybe traditional approaches like non-linear least squares could do the trick. However, the curve is rather sensitive because of the poles.

Another issue is that I don’t exactly know the number of terms used in the series. Maybe poles at zero or infinity are not present, and it is just LC resonators, or maybe just one LC resonator can fit it nicely.

Which would be the best way to start with?

Thanks!

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [August 4, 2020, 7:27am UTC](https://discourse.julialang.org/t/choose-a-tool-for-curve-fitting-out-of-all-available/44202/2 "2020-08-04T07:27:03Z")

</div>

> [@nandoconde](#):
>
> On the other hand, maybe traditional approaches like non-linear least squares could do the trick. However, the curve is rather sensitive because of the poles.

You could use weights in the objective function to influence these things.

> [@nandoconde](#):
>
> Which would be the best way to start with?

I would help to decide on the methodology first before implementing it in Julia. While you can get general numerical/computational advice here, your field may have a preferred method. It would be best to talk to your thesis advisor first, focus on something concrete, and then ask how to implement that in Julia.

---

<div class="post-metadata">

**Author:** ![MatFi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/matfi/32/10002_2.png) [@MatFi](https://discourse.julialang.org/u/MatFi)\
**Post date:** [August 4, 2020, 7:51am UTC](https://discourse.julialang.org/t/choose-a-tool-for-curve-fitting-out-of-all-available/44202/3 "2020-08-04T07:51:59Z")

</div>

Part of my master thesis involved fittings of complex impedance data (which is in principle what you want to archive). That times I used a implementation of [motofit](http://motofit.sourceforge.net/wiki/index.php/Main_Page) , which worked pretty well. It is a sort of differential evolution / genetic optimization method which has to my knowledge no Julia implementation so far, but the [BlackBoxOptim.jl](https://github.com/robertfeldt/BlackBoxOptim.jl) package provides comparable optimization strategies.
