MATLAB Answers

0

How can i write optimal control objective with fmincon?

Asked by zahra zamani on 4 Oct 2019
Latest activity Commented on by Matt J
on 4 Oct 2019
and my constraint is:

  0 Comments

Sign in to comment.

1 Answer

Answer by Matt J
on 4 Oct 2019
Edited by Matt J
on 4 Oct 2019
 Accepted Answer

Same as any objective...
Knowns=[lambda1,lambda2];
Jfun=@(Unknowns) objective(Unknowns,Knowns);
fmincon(Jfun , InitialGuess,[],[],[],[],lb,ub )
function J=objective(Unknowns,Knowns)
x=Unknowns(1:N);
u=Unknowns(N+1:M);
eps=Unknowns(M+1);
lambda1=Knowns(1);
lambda2=Knowns(2);
J=lambda2*eps^2+___________;
end

  2 Comments

You're welcome, but please Accept-click the answer if your question has been resolved.

Sign in to comment.