필터 지우기
필터 지우기

Linear Constrained optimization help

조회 수: 1 (최근 30일)
Sameer
Sameer 2014년 5월 19일
댓글: Star Strider 2014년 5월 19일
function [ h ] = LinConOp( x )
x0 = [-1,1];
lb = swtMinWt1;
ub = swtMaxWt1;
Aeq = swt_Aeq;
beq = swt_beq;
A = swt_A;
b = swt_b;
[x,fval] = fmincon('objfun',x0,A,b,Aeq,beq,lb,ub);
end
it shows errors for the x's and the fval. what am i doing wrong here?
  댓글 수: 1
Star Strider
Star Strider 2014년 5월 19일
You’re passing x as an argument to LinConOp and aren’t assigning h so your function isn’t returning anything.
I suspect the fval error results from fmincon not knowing what objfun is. It’s not in the LinConOp function workspace.

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

답변 (1개)

Alan Weiss
Alan Weiss 2014년 5월 19일
편집: Alan Weiss 2014년 5월 19일
I do not understand why you have all these calls in a function (LinConOp). The function does not see the parameters that are (presumably) in your MATLAB workspace.
Can you try to just run your commands at the MATLAB command line, not inside a function?
Alan Weiss
MATLAB mathematical toolbox documentation

카테고리

Help CenterFile Exchange에서 Portfolio Optimization and Asset Allocation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by