Skip to main content
1-Visitor
March 14, 2017
Question

Parametrize Odesolve and define constants by least sqeare

  • March 14, 2017
  • 3 replies
  • 12017 views

Hello everyone, I am going to parametrize solving block (odesolve func) and then define corresponding coefficients by least square.  But unfortunately, I meet problem after parametrization of the solve block. Could someone help me with this? Thank you in advance. You can find example of the program attached

3 replies

25-Diamond I
March 14, 2017

Hope that the attached will help.

At the end of the attached file you also find a way to use a solve block with "minerr" to get the optimal value for a.

1-Visitor
March 15, 2017

What about this:

ParEst.png

Viktor

1-Visitor
March 15, 2017

Thank you very much, it works geat. The last question is about few differential equations. I need to solve a system of diff equations but fit them by the data for only one of the main variables.  For example:

We have  system   p' (t) = a*p -B*p^2 and n' (t) = a*n; with some init cond p(0)=0 and n(0)=1; So I need fit this system by some data from p1 = [10,20,30,40] , t1= [0,1,2,3]. How it is better to do this .

Regards.

1-Visitor
March 17, 2017

Hello everyone,

I am trying to find parameters of the set of differential equations. So, I solve st of dif equations by Odesolve (see attacehed) and then trying to minner coefficients a and Nt1 using experimental data Con and t11.  The system must at least work, but I have error at Minerr step. Could someone help me with this? Thank you, very much.

Odeslove.png

25-Diamond I
March 17, 2017

Obviously the guess values are at a magnitude which makes the odesolve block fail.

Changing the guess for a in the minerr block makes the block  work, but the odesolveblock fails using those values:

1-Visitor
March 17, 2017

Thank  you, it works now. I went further and meet the next problem.

Minerr function calculates coefficients , but they are negetive some time. How can I give additional condition where all the coefficients must be a positive value. Sorry for obstruction, it look like the last problem which I need to solve.

example.png

1-Visitor
April 10, 2017

Hello everyone,

Can I use the following (see attached) consistent Equality conditions constructions to fin 2 data sets Con1(I1) and R1(I1) by the same parameters.

I am solve set of equations and get n(I1) and p(I1) , so then I compare p(I1)*e*60=Con1(I1) and (p(I1)*60^2-n(I1)*925^2)/e*(p(I1)*60+n(I1)*925)^2 = R1.

I found out that if I delete the firstEquality condition fit does not change. So this can mean that I use wrong Mathcad syntax. Unfortunately, I did not find some similar programs.

Can someone experienceexampl.png with this?