Linear Constrained optimization help

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 日

0 投票

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

カテゴリ

ヘルプ センター および File ExchangeNonlinear Optimization についてさらに検索

質問済み:

2014 年 5 月 19 日

コメント済み:

2014 年 5 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by