using fminsearch to optimization two parameters which depend on each other
4 views (last 30 days)
Show older comments
hi everybody, my question about optimization with MATLAB's "fminsearch" function, in order to find out actual model parameters that give appropriate simulation results compare to measured data, in my mfile I created an "error" variable which is square of difference between simulation result and measured data, so fminsearch gives satisfactory results which minimize variable "error" and helps to parametrize module well. But in one case I don't have 1st hour of measured data, and the model parameter that I want to find out (function of time) is also depends on initial value, for that reason I could not get any fit results, here e.g. as initial voltage (before one hour) is not known the result of optimization gives an initial voltage value is so high and parameter (resistor) that I am looking for is too low, any idea will appreciated, thanks in advance
0 Comments
Accepted Answer
Matt J
on 14 Feb 2014
Edited: Matt J
on 14 Feb 2014
Do you have any more sophisticated solvers, e.g., from the Optimization Toolbox? If so, the natural thing would be to impose optimization constraints on how the curve behaves in the first hour.
If you only have fminsearch, a poor man's solution would be to add a penalty on behavior that you consider bad. For example, you said the current fit is too high, so you could do
fminsearch(@(p)norm(f(x,p)-y)+beta*(f(1,p)) )
This will discourage large values of f(x,p) at x=1, where beta>=0 is a tuning parameter.
2 Comments
Matt J
on 14 Feb 2014
Edited: Matt J
on 14 Feb 2014
But clearly there are things you know about the shape of the curve even in the extrapolation region, where you have missing data. Otherwise, how would you know that the unconstrained fit values are "too high" there, to use your words.
You might have a look at this
It lets you fit curves with all kinds of condition on shape. The curve is a spline fit, but you might be able to use it to extrapolate/fill in the missing data. Then you can re-run the fit with any model you want and with no missing data.
More Answers (0)
See Also
Categories
Find more on Nonlinear Optimization 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!