Fminsearch: more initial values than parameters
Afficher commentaires plus anciens
Hi,
I am using fminsearch to estimate 4 parameters: x(1), x(2), x(3), and x(4). The problem is that I wish to use two objective functions to estimate these parameters: the two functions share the parameters x(2) and x(3) where as x(1) is unique to the first objective function and x(4) is unique to the last objective function. I have included the two functions below:
@(x) x(1)*exp(-t*(x(1)+x(3)))+(x(3)*((x(2)*exp(-t*x(2))*(x(1)+x(3)))/(x(1)-x(2)+x(3))-(x(2)*exp(-t*(x(1)+x(3)))*(x(1)+x(3)))/(x(1)-x(2)+x(3))))/(x(1)+x(3))
@(x)-exp(-t*x(3))/(x(3)/x(4)-1)-exp(-t*x(4))/(x(4)/x(3)-1)
I have a condition within my code which states which objective function should be used for each value of t. Finally, 4 initial values are specified for fminsearch each time.
I originally thought that as x(4) is not included within the first function that fminsearch would not attempt to calculate this parameter. The issue is that this seems to not be the case; random estimates of this 4th parameter are still made, despite the fact that it is not within the objective function. Why is that?
I realise that this question may seem complicated (and like an atypical use of fminsearch) so I suppose a more straightforward scenario is that of an objective function with only one parameter: if you provide a vector of 5 initial values then you will get back a vector of 5 parameter estimates where only the first is a legitimate estimate and the other 4 seem like nonsense. For some reason, however, these nonsense parameters aren't set to 0, is there any way that I can make sure that they are? Is it possible to specify x(4) is a fixed value not to be estimated, i.e. x(4)=0?
2 commentaires
I'm a little confused. Are you running fminsearch for a fixed value of t? If so, why not seperate this into two objective functions and run it with just that value of t instead of doing it this way. That way, you would get 3 parameters estimated in the case where you have 3, and vice versa (and it would save on computation time).
The basic reasons is that the optimizer is using a reflection pattern to try to optimize which means it will poll values of x(4) frequently which are not zero. These won't affect the objective function, since it doesn't enter into it, so it could very well find a value of the other parameters which are optimal but x(4) is not zero. Both are minimums of your function.
If you know ex ante that the value for x(4) is junk, then you could just set it to zero after the solver ends.
Conor Donnelly
le 12 Jan 2016
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Estimate Parameters and States dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!