Nonlinear optimization by using MATLAB built in functions

2 views (last 30 days)
Hello everybody,
I have a question regarding the optimization algorithms. I have used some of them so far, in order to do some system identification. At the moment I am trying to use the optimizer to find the optimal inputs to system that I am simulating. Basically the output of the system responds to N input parameters, I have a target value for the output of my system and I define my error function as the difference between the output value obtained by the current combination of parameters at the current iteration. Basically after every new simulated point, I check the gradient of the new values, and I use those gradients to set the next step, basically a gradient descent optimization. Normally one could do this in MATLAB by using the optimizer built in functions, but they always request the knowledge of the function to optimize and the there any way to use those functions without having the whole regression matrixes and vectors in advance? or do I need to develop myself those iterative solutions?

Accepted Answer

John D'Errico
John D'Errico on 1 Oct 2015
Edited: John D'Errico on 1 Oct 2015
No. The tools in MATLAB absolutely do NOT require knowledge of the gradient!!!!!!
In general, the optimization tools in MATLAB require for the function nothing more sophisticated than a "black box", a function that you can pass parameters into and it returns an objective value.
As it is, you claim that you are computing the gradient anyway. So why would that be a problem? That you are using what is essentially steepest descent suggests that you would be far better off using a more intelligent tool.
Since I do not know what problem you are solving, nor how many parameters are involved in the estimation, I cannot suggest an optimizer. fminsearch is a simple choice, if you have no constraints, and up to roughly 6 or so parameters. Larger problems would normally go to one of the routines in the optimization toolbox. Or you can always look to the file exchange if you lack that toolbox.
Giovanni on 2 Oct 2015
Hello John. Thanks again for your precious comment. I have generated a function that calls my simulator with some initial vlues for my parameters. Then I have defined my error function as the absolute value of my target vale minus the value of the function obtained by the simulation. It wasn´t just clear to me at the beginning how to define my target function and how to properly use the fminsearch algorithm. About the solution pointing toward a local minimum, I know that this could come in play, but in general those functions I am working with should have in general has just one minimum. A second aspect that I didnt´t take into account is that the optimizer also allows negative values of the parameters, which is not my case. So I really guess I need to find out another method to use.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!