Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
parameter estimation and ode45

Subject: parameter estimation and ode45

From: Marcio Barbalho

Date: 29 Jan, 2010 16:09:25

Message: 1 of 7

Dear friends...

how to solve problems like this?

dy1/dt = y1*a - y2*b
dy2/dt = y1*y2 - c

a, b and c are parameters, y(i) are (given) variables. I would like to find the best values for a, b and c in order to fit my data to my model.

Thank you.

Subject: parameter estimation and ode45

From: Luca Zanotti Fragonara

Date: 29 Jan, 2010 16:27:06

Message: 2 of 7

"Marcio Barbalho" <marciobarbalho@yahoo.com> wrote in message <hjv17k$llo$1@fred.mathworks.com>...
> Dear friends...
>
> how to solve problems like this?
>
> dy1/dt = y1*a - y2*b
> dy2/dt = y1*y2 - c
>
> a, b and c are parameters, y(i) are (given) variables. I would like to find the best values for a, b and c in order to fit my data to my model.
>
> Thank you.




So it's an identification problem of a non linear model. I would use fmincon with an ode solver inside your fmincon function, which estimates your cost function.

To use ODE:

[tsol,y] = ode45(@diffeq,t,ystart,options,a,b,c);

function dydt=diffeq(t,y,par_ex)
dydt = [y(1)*a - y(2)*b;
         y(1)*y(2) - c];

Subject: parameter estimation and ode45

From: Jan Simon

Date: 29 Jan, 2010 16:33:24

Message: 3 of 7

Dear Marcio!

> how to solve problems like this?
>
> dy1/dt = y1*a - y2*b
> dy2/dt = y1*y2 - c
>
> a, b and c are parameters, y(i) are (given) variables. I would like to find the best values for a, b and c in order to fit my data to my model.

1. Start with an inital guess for [a] and [b].
2. Then vary both guesses by a certain small step [h].
3. Now you can calculate the sensitivity of the result to the variation of the input.
4. Modify your [a] and [b] according to this sensitivity such that the difference between the wanted and found solution is decreased (in a matching norm).
5. Go to 2. until the changes in [a] and [b] are smaller than a certain value or any other matching condition is reached.

Especially for point 4. there are a lot of different methods, e.g. line search. Choosing a good [h] in step 2. fills chapters and books also.

If you want any details, please ask for details.

Good luck, Jan

Subject: parameter estimation and ode45

From: Marcio Barbalho

Date: 29 Jan, 2010 17:00:20

Message: 4 of 7

Could you please give more details on how to create this code?

Many thanks

Subject: parameter estimation and ode45

From: Torsten Hennig

Date: 30 Jan, 2010 11:33:26

Message: 5 of 7

> Could you please give more details on how to create
> this code?
>
> Many thanks

Couple an ODE-solver and a least-squares solver,
e.g. ODE45 and LSQNONLIN.
This is the way to solve your problem with least effort.

Best wishes
Torsten.

Subject: parameter estimation and ode45

From: Rajiv Singh

Date: 2 Feb, 2010 22:22:27

Message: 6 of 7

See nonlinear grey box modeling feature in System Identification Toolbox.
Basically, you can write a MATLAB file containing your equations and use it
to create what is called a "grey box model". This model then lets you define
parameters and estimate their values using data. See:

http://www.mathworks.com/access/helpdesk/help/toolbox/ident/ug/bq4gq5r-1.html

Also see various demos on this topic under the section "
Tutorials on Nonlinear Grey Box Model Identification
" on system identification product page(demo section):
http://www.mathworks.com/products/sysid/demos.html

Rajiv

"Marcio Barbalho" <marciobarbalho@yahoo.com> wrote in message
news:hjv474$55q$1@fred.mathworks.com...
> Could you please give more details on how to create this code?
>
> Many thanks

Subject: parameter estimation and ode45

From: Marcus M. Edvall

Date: 3 Feb, 2010 02:34:30

Message: 7 of 7

Dear Marco,

Take a look at this example: http://tomdyn.com/examples/marinePopulation.html

You could do something similar to that.

Best wishes, Marcus
Tomlab Optimization Inc.
http://tomopt.com/
http://tomsym.com/

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us