How do I minimise a function that has a vector output?

Hello. I have a function with six input angles, and outputs a 1x6 vector. The plan is to subtract this from another 1x6 vector to make an "error" vector to minimise. I understand from the literature that fminsearch and similar functions all have a scalar output. Basically, I would like to know if there is a function that changes the input angles to minimise all six elements in the output error vector? Thanks!

Respuestas (1)

Stephen23
Stephen23 el 6 de Jul. de 2018
Editada: Stephen23 el 6 de Jul. de 2018
"I would like to know if there is a function that changes the input angles to minimise all six elements in the output error vector?"
Add weighting to the error values if required (e.g. square the values), then sum them. Minimize the sum. Any "minimizing of the vector" will ultimately be exactly equivalent to this, so that is the solution. You could use lsqnonlin (which requires a vector output from the cost function), but note that this implicitly sums the squares of the vector, so it amounts to exactly the same thing.

5 comentarios

Thanks for your answer Stephen. Unfortunately, that particular solution hasn't worked for my application as I believe lsqnonlin doesn't accept vectors as the cost function. I'm sorry that I didn't make this clear in my question. Do you know of any functions that will accept vector inputs and also return a vector output?
Jan
Jan el 9 de Jul. de 2018
Editada: Jan el 9 de Jul. de 2018
Stephen has explained you, how to provide a scalar based on the vector output of your function: You can use the sum, the sum of squares, the sum of absolute values, the angle between the vector and a specified vector and a lot of further methods. But you cannot "minimize a vector". This is simply not a meaningful task. A trivial example: Imagine you get two vectors [1,2] and [2,1] which one is "smaller"? And when there is no definition of "smaller", you cannot "minimize".
Neither lsqnonlin nor any other tool for minimization will accept a vector as optimization criterion.
Hi Jan, thank you for your comment. Maybe I should explain in more detail. When I say minimise a vector or array, I mean that each element contains several (or possibly all) of the unknown variables that I wish to find. The "minimisation" I have in mind is the process of finding the values of the variables/unknowns such that the values in ALL elements in the array are the smallest. If there is no tool that accepts vector cost functions, do you know of any functions/tools that can run minimisations in parallel for functions that are coupled? Thanks in advance
Something like this I guess: https://uk.mathworks.com/help/gads/pareto-front-for-two-objectives.html
Stephen23
Stephen23 el 13 de Jul. de 2018
Editada: Stephen23 el 14 de Jul. de 2018
"The "minimisation" I have in mind is the process of finding the values of the variables/unknowns such that the values in ALL elements in the array are the smallest."
Add weighting as required. Sum the squares, or use min. Minimize that scalar. It amounts to exactly the same thing (which is why minimizing a scalar is all you need).

Iniciar sesión para comentar.

Categorías

Más información sobre Mathematics en Centro de ayuda y File Exchange.

Preguntada:

el 6 de Jul. de 2018

Editada:

el 14 de Jul. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by