Fitting experimental data to models

9 views (last 30 days)
Marcelo
Marcelo on 4 Jul 2014
Commented: dpb on 7 Jul 2014
Good afternoon,
I'm not a very experienced person using MATLAB, but I know the basics. Still, i don't know the answer to this question, and it may be stupid and the answer may be very simple but I can't figure it out.
So I have a group of experimental data, let's say Y was experimentally measured as a function of X, and a set of aprox. 100 points was obtained.
I have a model that should fit to the data, but the fact that the experimental conditions are different, it doesn't. So the model has basically 3 (or eventually 4) parameters that can be changed. And these are the parameters I want to change, in order to fit the model to the experimental data.
The problem (for me at least) is that the model is not straightforward. I could easily due this by calculating the square difference between the experimental Y and the "theoretical" Y and minimize the sum of those values, by changing those values. But since I the model is a system of 7 non-linear equations, I can't really solve them without using some numerical method.
Is there any way to solve this?
Thanks
  4 Comments
Star Strider
Star Strider on 4 Jul 2014
Ahhh ... dpb I believe you intend fminsearch.
Otherwise, it depends on the nature of your ‘7 non-linear equations’. It might be similar to integrating an ODE as part of the objective function, but using the fsolve function (Optimization Toolbox) instead of an ODE solver, or it could be impossible. You haven’t told us enough.
Consider solving them with the Symbolic Math Toolbox in terms of the independent and dependent variables and the parameters, and using matlabFunction to create a function file or anonymous function from the solution. No guarantee that approach will be successful either, especially if powers of the variables or parameters are involved. (Powers generate multiple solutions for the variables or parameters of interest.)
dpb
dpb on 4 Jul 2014
Ah, yes...mixed metaphor, so to speak, Star S... :)
Cyclist, figured it was so generic as to only be worth trying to elicit some additional detail at present...
NB: did edit response to correct the misspoke function name.

Sign in to comment.

Answers (1)

Marcelo
Marcelo on 7 Jul 2014
I have already used before fminsearch...But still I'm not very sure how to use it in this case. Altough I have only one function to minimize (the sum of the square of the deviations), to calculate the deviation in each point, i need to solve that group of 7 non linear equations. How can I use fminsearch, knowing this? Thanks
  1 Comment
dpb
dpb on 7 Jul 2014
Again, generalities don't cut it...what, precisely, is meant by "solve" in this context? I took it that you had seven equations that combine to generate the overall response; if so, that's all you need--write a function that computes the response and computes the residual for each point.
If, otoh, "solve" means you also must find roots of or otherwise "solve" these seven equations prior to being able to compute the above response, then as long as those are indeed solvable I don't see any great difficulty (in concept anyway) of including that in the function. fminsearch doesn't care how you get the answer, only that you can compute the residual.
Again, details are important here, and as the Mind Reading Toolbox is yet (still) to be released, we're sorta' at a disadvantage here...

Sign in to comment.

Categories

Find more on Get Started with Optimization Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!