How to specify Multiple constraints for LSQLIN
4 ビュー (過去 30 日間)
古いコメントを表示
I have X = 50 data points for 6 parameters, resulting in output vector Y of 50 data points. I have first constrained the problem so that the Y predicted values are > 0 by setting A = -X, b = 0*Y, and solved via BETA = lsqlin(X,Y,A,b) . I now want to specify multiple constraints so BETA(1)*X(1) + BETA(2)*X(2) is always > 0 , BETA(3)*X(3) + BETA(4)*X(4) > 0 , and BETA(5)*X(5) + BETA(6)*X(6) > 0 for all 50 predicted values. Can someone help me with this? Thanks.
0 件のコメント
採用された回答
Matt J
2013 年 6 月 18 日
tmp={X(:,1:2),X(:,3:4),X(:,5:6)};
A=-[X;blkdiag(tmp{:})];
b=zeros(size(A,1),1);
lsqlin(X,Y,A,b)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Linear Least Squares についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!