minimum function(fmincon)

조회 수: 8 (최근 30일)
Chongqing Fan
Chongqing Fan 2016년 6월 15일
편집: Chongqing Fan 2016년 6월 15일
Thank u so much for your attention for my question, the minimum is the value required, the "fmincon" matlab function is used, and the algorithm is default, but there is a problem not addressed, the following is the code:
function responsemum = numresponse(num) %%%%function 1
swith num
case 1
responsenum = @(x,y)x+y;
case 2
responsenum = @(x,y)x.*y; %%%%end of the function 1
function y = innerprod(fun1,fun2) %%%% function 2
y = @(x,y)fun1(x,y).*fun2(x,y); %%%end of function2
metag = innerprod(numresponse(1),numresponse(2));
TL = [-1,-1];
TU = [1,1];
T0 = [0,0];
[tmin,hlmin,exitflag] = fmincon(@(x,y)metag(x,y),T0,[],[],[],[],TL,TU);
there is some error message after run the code:
Error using@(x,y)metag(x,y) not enough input arguments
if u can give me any help, i will be appreciated, Thanks!
  댓글 수: 2
per isakson
per isakson 2016년 6월 15일
It's difficult to read the code. Where do functions end?
Chongqing Fan
Chongqing Fan 2016년 6월 15일
First, thank u so much for your attention about my question, i have edit my question, and give some explanation about my question!

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

채택된 답변

Walter Roberson
Walter Roberson 2016년 6월 15일
[tmin,hlmin,exitflag] = fmincon(@(xy)metag(xy(1),xy(2)), T0, [], [], [], [], TL, TU);
  댓글 수: 1
Chongqing Fan
Chongqing Fan 2016년 6월 15일
편집: Chongqing Fan 2016년 6월 15일
Mr. Walter, Thank u so much for your help, every time you give me a fish, hope i can learn how to fishing, and i can survive by myself in the future!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 GPU Computing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by