using fminsearch to optimization two parameters which depend on each other
5 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Matt J
2014-2-14
编辑:Matt J
2014-2-14
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 个评论
Matt J
2014-2-14
编辑:Matt J
2014-2-14
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Nonlinear Optimization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!