need help: optimization using fmincon in a simulink level-2 matlab s-function block

2 visualizaciones (últimos 30 días)
Hi,
I would like to express the following objective function in a simulink level-2 matlab s-function block using fmincon as solver:
f(x,y) = x*tan(y(k+1)) + c*(y(k+1)-y(k))
where k is the step time.
My problem is in the variable y, I can't express it to be able to use it in fmincon and, all my attempts so far have been unsuccessful.
Your help will be very important to me!
Thank you...

Respuestas (1)

Ameer Hamza
Ameer Hamza el 11 de Mzo. de 2020
Editada: Ameer Hamza el 11 de Mzo. de 2020
To use fmincon, the objective function must accept a single input variable, which can be a vector. So for your function, you can pass it to fmincon as
sol = fmincon(@(x) f(x(1), x(2)), ..... )
Note that the initial point x0 also need to be 1x2. The returned value will also be 1x2.
  5 comentarios
Ameer Hamza
Ameer Hamza el 11 de Mzo. de 2020
I am not sure whether fmincon can help in such a case. You may need to reformulate the optimization problem such that the value of the objective function can be evaluated just by using input variables.

Iniciar sesión para comentar.

Categorías

Más información sobre Manual Performance Optimization en Help Center y File Exchange.

Productos


Versión

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by