Finding the minimizer using fminunc.
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Howie
el 4 de Nov. de 2022
Comentada: Howie
el 5 de Nov. de 2022
If I have function:
fv = @(x) x(1)^2 + x(1)*x(2) + (3/2)*x(2)^2 - 2*log(x(1)) - log(x(2));
How would I use the function fminunc to find the minimizer rather than the minimum value?
0 comentarios
Respuesta aceptada
Torsten
el 4 de Nov. de 2022
fv = @(x) x(1)^2 + x(1)*x(2) + (3/2)*x(2)^2 - 2*log(x(1)) - log(x(2));
[minimizer,minimum_value] = fminunc(fv,[1; 1])
3 comentarios
Más respuestas (1)
Walter Roberson
el 4 de Nov. de 2022
If you need to find a maximum rather than a minimum then construct
nfv = @(x) -fv(x)
now minimize nfv using fminunc.
If you need to display what the maximum is remember to evaluate fv at the location of the maximum.
1 comentario
Ver también
Categorías
Más información sobre Solver Outputs and Iterative Display 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!