Minimizing a prebuilt cost function

7 visualizzazioni (ultimi 30 giorni)
Kevin Hanekom il 9 Feb 2023
Commentato: Kevin Hanekom il 10 Feb 2023
I hope this reaches everyone well.
I have been attempting to minimize a complex function, deependent on a 6x7 inital guess matrix. I have built code that will output a weighted least squares difference between the expiremental and predicted data. Is there a way to use fmincon, fminsearch, etc... to minimize this value formed via the cost function?
To sumarize, I have a model that I transformed into a function with its only input being that 6x7 inital guess matrix, which outputs a value that exhibits the difference between the numerical simulated and expiremental. I wish to minimize this value, using fmincon, or any other solver to form guesses input into this function.
Thank you for your time!
Kevin
10 CommentiMostra 9 commenti meno recentiNascondi 9 commenti meno recenti
Kevin Hanekom il 10 Feb 2023
Modificato: Kevin Hanekom il 10 Feb 2023
Thank you for the input Matt. I apoligize for the confusion, in this case x0 is a single variable, I am inputing into the function I have defined called TsWuSph. This function outputs an expected numerical value, which I wish to minimize in comparison to expiremental, scalar, value cfinal(3,3). Just to sumarize, x0 should only be a single unkown output in this case.

Accedi per commentare.

Risposta accettata

Kevin Hanekom il 10 Feb 2023
My probelm was a classic example of derivative based algorithms convergence to a local, but not global minimum. To solve this one can use a heuristic, or population based algorithm, in this case either GA or the annealing method as listed in this great textbook, MIT Book.
Thank you everyone for your help.
2 CommentiMostra 1 commento meno recenteNascondi 1 commento meno recente
Kevin Hanekom il 10 Feb 2023
The one parameter problem was just a inital simplification of the much more complex probelm statement. I am sure the min function would work for the one parameter problem. Thank you for your help through my problem.

Accedi per commentare.

Più risposte (1)

Matt J il 10 Feb 2023
Modificato: Matt J il 10 Feb 2023
Just to sumarize, x0 should only be a single unkown output in this case.
If so, both lsqnonlin and fmincon are overkill. You should just use fminbnd or fminsearch, e.g.,
c=cfinal(3,3);
[x, fval] = fminsearch( @(x0) abs(TsWuSph(x0)-c) , Guess)
2 CommentiMostra 1 commento meno recenteNascondi 1 commento meno recente
Matt J il 10 Feb 2023
Modificato: Matt J il 10 Feb 2023
FAQ - See this highly related post:

Accedi per commentare.

Categorie

Scopri di più su Surrogate Optimization in Help Center e File Exchange

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by