cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

System of ODE and Minerr data fit optimization

amusiienko
8-Gravel

System of ODE and Minerr data fit optimization

Hello, everyone. I wrote a simple program that solves 5 differential equations. Further, I fit experimental data with MINERR. 

 

It works but it works very slow.  Does anyone know how to do it a bit faster?

 

Thank you in advance! Program is attached

amusiienko_0-1609098421368.png

 

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:amusiienko)

I notice that your odesolve-block returns 8 functions, but in your minerr-solve block you assign the result to a vector with just seven variables. Thats sure possible - are you sure you don't need p022.

I can't check your sheet because I always get the error message that Excel is busy, can't be activated and I shall try in a few seconds again.

I have Excel 2016 installed and I see in the task manager that its invoked. Not sure whats going on.

 

View solution in original post

7 REPLIES 7
Werner_E
25-Diamond I
(To:amusiienko)

Your minerr-solveblock calls the odesolve-solve block (function F) six times for every iteration, which is quite inefficient.

The modification seen in the pic below should speed up the calculation by the factor 6.

Werner_E_0-1609123148079.png

I turned the solve block into a function just to be able to determine and compare the execution time of both versions.

Werner_E
25-Diamond I
(To:Werner_E)

I just finished timing the two versions and the speed gain with my suggested modification is indeed a little bit more than factor 6.

Werner_E_0-1609124642976.png

P6 sheet (with auto-calc disabled) attached

 

Oh, interesting you have called function in vector format. That is interesting.

Thank you Werner_E. Your insight is very useful as always. 

Hi Werner,

After I applied your solution to my main program. It still works slow. 

I do not really see why. Maybe you could find it.

 

Thank you in advance!.

Werner_E
25-Diamond I
(To:amusiienko)

I notice that your odesolve-block returns 8 functions, but in your minerr-solve block you assign the result to a vector with just seven variables. Thats sure possible - are you sure you don't need p022.

I can't check your sheet because I always get the error message that Excel is busy, can't be activated and I shall try in a few seconds again.

I have Excel 2016 installed and I see in the task manager that its invoked. Not sure whats going on.

 

I added p022 "just in case" to use in the future. But seem it is critical for minerr function. After I deleted unused p022 it works much faster.

Thank again Werner.

You saved my day again!

Announcements

Top Tags