Curve fitting on non-linear ODE data

613 Views Asked by At

Background

The graph below was generated by a set non-linear ODEs.

For those of you who might want to know: It shows the maximum distance achieved by a cylinder when fired at a specified initial velocity (different graphs) vs the angle of the shot.

graph curve fit

I need help with the method for finding a single equation to describe these graphs.
I require an equation of the form y = f(d,v) where y is the maximum distance atainable ; d is the degrees elevation above the horisontal ; and v is the initial velocity.

What I have done thus far

About 80 data points were generated for each of the four initial velocities.

For each function:

I guessed a function and initial values for that function. I calculated the absolute difference between the simulation data and the data generated from the function. All of these errors were then summed. Excels built-in solver was used to minimize the total error by changing the parameters of the equation. This was repeated until convergence was reached.

An equation of the form

$$ y = A*exp(B*(d+C)) + D*exp(E*(d+C))+F $$

was found.

For those of you who want to test it out:

For the highest peak curve ; A = -26.8995 , B = 0.040039 , C = -21 , D = -0.59297 , E = -0.30423 , F = 400.2593 ; d = [1:80]*.

After this was done for all 4 graphs, the parameter values were moved to a different sheet. Each parameter was seperately graphed vs the four initial velocities ,v. E.g. A1-4 vs v1-4

It was then found that a 3rd order polynomial fit most of the data very well (obviously). I found it to be acceptable since the initial velocities that I used are 4 equally spaced values between the minimum and maximum possible values for initial velocity. Interpolating between them on the calculated curve will yield respectable results.

Thus the parameters of the first equation was found to be a 3rd order polynomial in v.

so finally;

$$ y = A(v)*exp(B(v)*(d+C(v))) + D(v)*exp(E(v)*(d+C(v)))+G(v) $$

This equation has 24 constants

This equation performed brilliantly for the most part. The maximum percentage difference to the ODE model was ~23%. Upon graphing the errors vs the degrees for all 4 initial velocities, it was seen that the error percentage is within the generally acceptable 5% range with the condition that the degrees are higher than 10 and lower that 75. This still leaves me with more than 80% valid values for the angle of launch. Totally acceptable for me.

I could theoretically curve fit the error to find error = f(d) for each graph and then fit the constants to curve as well, so that the final error = f(d,v). This multiplied with the double exponential function will effectively reduce my error to zero.

However, this method took a large amount of time to complete.

The question

How can I perform similar calculations on a much larger data set and possibly increase my valid data intervals? E.g. 500 intervals of degrees and 100 intervals of initial velocity? My method requires alot of "hand" work. I am confident that there exist other methods that will deliver a similar result with much less effort on my part.