Minimizing a prebuilt cost function
16 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Kevin Hanekom
el 9 de Feb. de 2023
Comentada: Kevin Hanekom
el 10 de Feb. de 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 comentarios
Matt J
el 10 de Feb. de 2023
Editada: Matt J
el 10 de Feb. de 2023
Yes to all! The absolute difference between, TsWuSph(x0) - cfinal(3,3), is what I wish to minimize.
Since cfinal(3,3) is a scalar value, that would be equivalent to solving for multiple unknowns x0 given a single equation. It is a considerably under-determined problem.
Respuesta aceptada
Kevin Hanekom
el 10 de Feb. de 2023
2 comentarios
Matt J
el 10 de Feb. de 2023
It is really unlikely you would do that just to avoid local minima for a 1-parameter problem. You would probably just sample the function over a range of points and use min
c=cfinal(3,3);
fun= @(x0) abs(TsWuSph(x0)-c);
x=linspace(a,b);
[~,i]=min(arrayfun(fun, x));
Guess=x(i);
Más respuestas (1)
Matt J
el 10 de Feb. de 2023
Editada: Matt J
el 10 de Feb. de 2023
Just to sumarize, x0 should only be a single unkown output in this case.
c=cfinal(3,3);
[x, fval] = fminsearch( @(x0) abs(TsWuSph(x0)-c) , Guess)
Ver también
Categorías
Más información sobre Optimization en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!