Borrar filtros
Borrar filtros

function with myblackbox using fminunc

2 visualizaciones (últimos 30 días)
Ali Esmaeilpour
Ali Esmaeilpour el 30 de Ag. de 2019
Comentada: Matt J el 30 de Ag. de 2019
Hello guys! I got a Function F(y(x)) = sum (( yref-y(x))^2) and x(1) = q and x(2)=r and x=[q;r] and yref=0. I wanted to code this function to be used in a multi-objective optimization etc.
my initial idea is:
function F = myblackbox(x)
q = x(1)
r = x(2);
yref = 0;
y = solvemyoptimizationproblem(q,r);
F = somefunctionofy(y);
but i don't know how to use fminunc here to do a blackbox optimization and how to replace those things to have F(y(x)) correctly.

Respuestas (1)

Matt J
Matt J el 30 de Ag. de 2019
Editada: Matt J el 30 de Ag. de 2019
lsqnonlin would be better suited to this,
x0=[q_guess,r_guess];
x=lsqnonlin( @(x) yfunction(x(1),x(2))-yref, x0);
  11 comentarios
Ali Esmaeilpour
Ali Esmaeilpour el 30 de Ag. de 2019
so I put that fminsearch at the end of my main code?
Matt J
Matt J el 30 de Ag. de 2019
fminsearch will search for the optimal x. You put it wherever you need the optimization to occur.

Iniciar sesión para comentar.

Categorías

Más información sobre Solver Outputs and Iterative Display en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by