Dynamic construction of constraint function in MATLAB optimization

Based on matlab help for defining the constraints in an optimization problem, it should be a function of X only.
forexample:
function f = objconstr(x)
f.Fval = 100*(x(2) - x(1)^2)^2 + (1 - x(1))^2;
f.Ineq = (x(1)-1/3)^2 + (x(2)-1/3)^2 - (1/3)^2;
Now, Assume that my FVAL , and INEQ equations are keep changes dynamicly due to the diffrent states.
forexample my constrain is equal to = F1(F2(F3(x))), which for instance, F3(x)= A.*(X).^(B)+(C) (calucated from a curvefitting function).
My question is that how can I define A, B, and C in my code, so I dont need to write the numbers (coeficients) and instead it read it from my workspace.

Answers (0)

Asked:

on 6 Apr 2020

Community Treasure Hunt

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

Start Hunting!