definition of nonlincon in the fmincon function
5 ビュー (過去 30 日間)
古いコメントを表示
Hi guys, I'm having trouble in defining the nonlincon when one of my nonlinear constraints is not the same size as the others. When I run the code it says error CAT argument. please how should I consider that? Thanks.
function [c ceq]=nonlincon(x)
c(1) = with m variabels x(1),..,x(m) : size[1,m]
c(2) = with n variables x(1),...,x(n) : size [1,n]
ceq=[]
0 件のコメント
採用された回答
Paul Kerr-Delworth
2012 年 8 月 31 日
Hi Mohammad,
The c output in your nonlincon function should be a vector or matrix, where each element of c is less than zero.
In your case, you should just be able to change your current function (note that I've changed the notation in your second vector) from:
function [c ceq]=nonlincon(x)
c(1) = with m variabels x(1),..,x(m) : size[1,m]
c(2) = with n variables y(1),...,y(n) : size [1,n]
ceq=[]
to:
function [c ceq]=nonlincon(x)
% Return a 1-by-m+n vector containing the constraints in your
% original "c(1)" and "c(2)"
c = [x, y];
ceq=[]
Hope this helps.
Best regards,
Paul
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Nonlinear Control についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!