이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

not enough input arguments while using fmincon

조회 수: 1(최근 30일)
Devashish Sharma
Devashish Sharma 2016년 7월 25일
마감: MATLAB Answer Bot 2021년 8월 20일
function f = fun( p )
a=[1 1];
x0=[2; 3];
[p funval]=fmincon(@fun,x0,a,b)
when i run this it says error in line 2 not enough arguments please help
  댓글 수: 1
John D'Errico
John D'Errico 2016년 7월 25일
편집: John D'Errico 2016년 7월 25일
Read the help docs for fmincon. LOOK AT THE EXAMPLES. In there you will see how to call fmincon.
In the case you have tried, the function that you pass into fmincon then tries to call itself.
Worse, you then say that you tried to run it. You cannot use run on a function.
It is time to learn what a function is, and how that is different from a script m-file.


Community Treasure Hunt

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

Start Hunting!

Translated by