フィルターのクリア

Aeq must have two columns error???

8 ビュー (過去 30 日間)
Sameer
Sameer 2014 年 5 月 28 日
コメント済み: Matt J 2014 年 5 月 28 日
this is my Aeq and beq:
swtOther_Aeq = [ 1 0 1 0 0 0 1 0 0 0 ]; swtOther_beq = [ 0.22 ];
yet matlab is telling me Aeq needs two columns.
I'm confused as to why. Can someone help me out? Thanks please.
  3 件のコメント
Sameer
Sameer 2014 年 5 月 28 日
well swtOther_Aeq right now means that stocks 1,3,7 should add up their weights to 22% (0.22) as depicted in the portfolio. This is in a control panel that can be switched up by someone who wants to run different stock weights ie the person can make 2,3,4 add to .15.
I am trying to minimize the variance of the portfolio, which has 10 (swtN) stocks.
this is what my fmincon looks like. W is a vector:
[W] = fmincon('objfun',x0,swtOther_A,swtOther_b,swtOther_Aeq,swtOther_beq,swtMinWt1,swtMaxWt1,[],options);
when i tried to run the program, it didnt give me error for swtotherA and b, so I dont know what is going wrong.
Thanks.
Matt J
Matt J 2014 年 5 月 28 日
If the variance is a quadratic function of the weights, you should use quadprog instead of fmincon.

サインインしてコメントする。

回答 (1 件)

Matt J
Matt J 2014 年 5 月 28 日
編集済み: Matt J 2014 年 5 月 28 日
You are passing an x0 with only 2 elements. The length of x0(:) should equal 10.
  13 件のコメント
Sameer
Sameer 2014 年 5 月 28 日
its now telling me "inner matrix dimensions must agree". i tried using dot multiplication but it does not work.
Matt J
Matt J 2014 年 5 月 28 日
"inner matrix dimensions must agree"
These are the kinds of errors that you troubleshoot using the dbstop command.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLinear Programming and Mixed-Integer Linear Programming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by