using fminsearch to optimization two parameters which depend on each other

5 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

Matt J
Matt J il 14 Feb 2014
Modificato: Matt J il 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 Commenti
Metin
Metin il 14 Feb 2014
in fact I have optimization toolbox but the problem comes from missing data, and the only thing I now for the fit function I am looking for, it is a fast decay of voltage with a increasing time constant, hence I am looking for the function of time constant that will fit all measured data well and also at the same time should be able to predict well initial voltage value. But initial voltage is not predictable as it depends on time variable time constant, for that reason restrictions of the problem is not so clear
Matt J
Matt J il 14 Feb 2014
Modificato: Matt J il 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.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by