Aeq must have two columns error???
古いコメントを表示
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 件のコメント
Star Strider
2014 年 5 月 28 日
We need a bit more information. What function are you using, what equality constraints do you want to impose on your parameters, what are your parameters, what is your model, and what are your data?
You do not have to post all your code and data, but enough for us to have a context for your Question.
All of us are good, some of us are brilliant, but none of us are mind-readers.
Sameer
2014 年 5 月 28 日
Matt J
2014 年 5 月 28 日
If the variance is a quadratic function of the weights, you should use quadprog instead of fmincon.
回答 (1 件)
You are passing an x0 with only 2 elements. The length of x0(:) should equal 10.
13 件のコメント
Sameer
2014 年 5 月 28 日
Matt J
2014 年 5 月 28 日
Why not just
x0(1:swtN)=0.10;
Sameer
2014 年 5 月 28 日
Matt J
2014 年 5 月 28 日
What happened when you tried it?
Sameer
2014 年 5 月 28 日
Matt J
2014 年 5 月 28 日
If you found that it works, I think you've answered your own question. If the variable x0 does not exist yet, it can be defined with an assignement statement
x0(1:N)=targetvalue;
This is one way (a compact one) of creating a length-N vector whose every entry is targetvalue.
Sameer
2014 年 5 月 28 日
If you insist on using fmincon, you must tell it how to pass VCVMatx to objfun. One option would be to call fmincon as follows
VCVMatx=...whatever...;
fun=@(W) objfun(W,VCVMatx);
fmincon(fun,x0,...otherarguments...);
Sameer
2014 年 5 月 28 日
Sameer
2014 年 5 月 28 日
Matt J
2014 年 5 月 28 日
"inner matrix dimensions must agree"
These are the kinds of errors that you troubleshoot using the dbstop command.
カテゴリ
ヘルプ センター および File Exchange で Problem-Based Nonlinear Optimization についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!