too many input arguments Fmincon

1 回表示 (過去 30 日間)
CSCh
CSCh 2023 年 1 月 10 日
コメント済み: CSCh 2023 年 1 月 10 日
Hi,how can I extended the inputs of the objectivefunction in this example
lets say to more input variables like:
objFun = @(parameters) objectiveFunction(parameters,x1,y1,z1,t1,x2,y2,z2,t2,U0,parameterNames,parameterSizes);
parametersV = fmincon(objFun,parametersV,[],[],[],[],[],[],[],[],[],options);
I got the error
Too many input arguments.
Error in fmincon (line 307)
f = feval(funfcn{3},x,varargin{:});
Error in skrip3 (line 858)
parametersV = fminunc(objFun,parametersV,[],[],[],[],[],[],[],[],[],options);
Thank you.

採用された回答

Torsten
Torsten 2023 年 1 月 10 日
parametersV = fmincon(objFun,parametersV,[],[],[],[],[],[],[],options);
instead of
parametersV = fmincon(objFun,parametersV,[],[],[],[],[],[],[],[],[],options);
  1 件のコメント
CSCh
CSCh 2023 年 1 月 10 日
Thank you Thorsten. It works!

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2023 年 1 月 10 日
the parameter order is
  • function - objFun
  • x0 - parameters
  • A - []
  • b - []
  • Aeq - []
  • beq - []
  • lb - []
  • ub - []
  • nonlcon - []
  • options - []
  • extra1 - []
  • extra2 - options
When there are extra parameters then the extra are passed as additional parameters to the objective function and to the nonlinear constraint function. You have two extra parameters so objFun would have to take 3 parameters
  1 件のコメント
CSCh
CSCh 2023 年 1 月 10 日
Thank you Walter, now it is clear!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by