How to use code constraint file for fmincon function

I am a beginner, i am trying to use the fmincon function to optimize the design of a separator vessel,in the constraint file i have a variable (Urg) which is calculated earlier in the program the constraint is (c4=Urg*(x(1)-Lll)-x(2)*Uog; when i run the program it gives me error Undefined function or variable 'Urg'.Pleas how to solve this problem and when i call Urg it gives its calculated value.

Respuestas (2)

Matt J
Matt J el 26 de Sept. de 2013

0 votos

We can only assume (especially without seeing code) that you accidentally cleared Urg.
Alan Weiss
Alan Weiss el 30 de Sept. de 2013

0 votos

It is possible that you calculate the value Urg in one function and then try to use it in another. There is a documented way to share a result between the objective function and nonlinear constraint functions.
But without further details I am just guessing.
Alan Weiss
MATLAB mathematical toolbox documentation

Preguntada:

el 25 de Sept. de 2013

Respondida:

el 30 de Sept. de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by