Python Forum
Fitting experimental data with differential equations : Optimization
Thread Rating:
  • 2 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fitting experimental data with differential equations : Optimization
#1
Hello !!!

I'm a physics student trying to solve an experimental problem in fluid dynamics and here is the issue I'm having.
The data output of my experiment is a 2D trajectory ([X,Y] array). I also have a theoretical model in the form of 3 coupled differential equations, solved using Runge Kutta 4, which also gives me a 2D trajectory ([x,y] array). This model depends mainly on 3 constants (a,G,B) of unknown values.
Here is an equivalent python script of my problem:

import matplotlib.pyplot as plt
import numpy as np

XY = np.loadtxt("experimental_data.txt")
plt.plot(XY[:,0],XY[:,0],label="experimental data")

x,y = Solver_diff_eqt(a,B,G) #Solution of my model
plt.plot(x,y,label="model")

plt.legend()
plt.show()
Obviously my code is much more complicated, but this is the basic idea.
So finally my question. I'm looking for a tool or an algorithm which could optimize the values of (a,G,B) by trying to minimize the difference between my XY graph and my xy graph. Think

(I guess that a better way to say it is : "I've 2 distributions, one of which depends on 3 constants. I'm looking for a way to calculate these 3 constants so that the 2 distributions are the same.", but it's harder to understand)

To give you some context on what I already tried.
I tried doing it by hand with sliders but it's way too complicated.
I tried to use scipy.optimize.curve_fit with an intelligent hack, but I'm obviously not intelligent enough Tongue .

Now you know everything ... Can you please help me ? Pray Pray
Thanks
Reply


Messages In This Thread
Fitting experimental data with differential equations : Optimization - by madoko - Jan-14-2019, 03:52 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Sine fitting - extra modulation Pikano 2 1,024 Jan-04-2023, 07:41 AM
Last Post: Pikano
  Fitting transfer function model to FRF data ymohammadi 0 1,697 Feb-10-2022, 10:02 AM
Last Post: ymohammadi
  Transfer function from experimental data thunderspeed 0 1,402 Oct-18-2021, 05:11 PM
Last Post: thunderspeed
  Error in running the Elliott Fitting function shashisourabh 9 5,284 Nov-19-2020, 06:54 PM
Last Post: osvan
  plot differential equation sympy dan_adi 0 3,015 Oct-13-2020, 10:44 AM
Last Post: dan_adi
  curve fitting matlotlib scipy Cjstarling 2 2,485 Sep-15-2020, 02:56 PM
Last Post: Cjstarling
  construction of Neural Network for solving Differential equations arshad 0 1,625 Jun-04-2020, 09:20 AM
Last Post: arshad
  Need Help solving second order differential equations SkewedZone 2 3,125 Jun-25-2019, 12:14 PM
Last Post: SkewedZone
  Fitting Lognormal Data Carolyn 3 16,105 May-21-2018, 12:10 AM
Last Post: scidam

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020