while using fmincon solver in optimtool.......i got problem...in the window i got a message as
Optimization running.
Undefined function or method 'obj.m' for input arguments of type 'double'.
please suggest me what to do?

 채택된 답변

Sargondjani
Sargondjani 2012년 6월 8일

0 개 추천

although this does not matter much, you should add an 'end'
how do you call obj.m with fmincon? and where did you store obj.m??? if you call obj(x0) in the line before your fmincon, does it work then?

댓글 수: 6

kintali narendra
kintali narendra 2012년 6월 8일
sir....i just forget to copy end,this time i am using optimtool window to optimize....in the objective function slot i have given called the function by typing"@obj.m"....i stored the file in the same place where other programs were there......i didn't get your lost question sir,sorry
Sargondjani
Sargondjani 2012년 6월 8일
about the last question: i m sorry, i forgot you used optimtool. i never used that.
however, i searched a bit and the error you get seems to occur only when the function is not defined, ie. when it is stored in another directory for example (or maybe if there are multiple files with the same name)
kintali narendra
kintali narendra 2012년 6월 8일
dear sir,i checked the whole folder there is no other file named as obj....are there any other things which i need to check that makes my function undefined...please do inform me ..
Sargondjani
Sargondjani 2012년 6월 9일
im pretty sure it has to do something with matlab not being able to call the function... it's hard to say for outsiders why exactly this happens. did you try using a program to call fmincon?? you could do this, just to test if obj.m works... then you could write "obj(x0)" in the line before you call fmincon to see if it works
Walter Roberson
Walter Roberson 2012년 6월 9일
Do not use @obj.m -- use @obj
kintali narendra
kintali narendra 2012년 6월 9일
thanku sir it worked...thanku so much

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Sargondjani
Sargondjani 2012년 6월 8일

0 개 추천

apparently you somewhere call a function "obj.m" with an 'double' input and this is not allowed
we can't help much more if you dont post the line where the error occurred and maybe a summary of the code inside obj.m

댓글 수: 2

kintali narendra
kintali narendra 2012년 6월 8일
sir this is the obj.m program
function f = obj(x)
pm=pi/3;
w=0.008;
wt=10;
ws=0.001;
ka=2;
ku=4;
ta=420;
tu=460;
Lu=60;
La=40;
s=(-(x(2)*(w^(-x(4)))*sin((pi/2)*x(4)))+(x(3)*(w^(x(5)))*sin((pi/2)*x(5))));
r=x(1)+((x(2)*(w^(-x(4)))*cos((pi/2)*x(4)))+(x(3)*(w^(x(5)))*cos((pi/2)*x(5))));
f = 20*log10((ku/sqrt((ta*w)^2+1))*sqrt(r^2+s^2));
sir please do tell me if i have made a mistake.....
kintali narendra
kintali narendra 2012년 6월 8일
the above mentioned is my program....

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Problem-Based Optimization Setup에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by