Solving weighted least squares problem with linear constraints

I am trying to solve a weighted least squares problem with both linear inequality and linear equality constraints. Which Matlab function should I use?

 採用された回答

Torsten
Torsten 2015 年 7 月 2 日

1 投票

help quadprog
Best wishes
Torsten.

1 件のコメント

maagen
maagen 2015 年 7 月 2 日
Thanks Torsten! I guess I just need to rewrite my weighted least squares problem in quadratic form...

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

その他の回答 (1 件)

John D'Errico
John D'Errico 2015 年 7 月 2 日

1 投票

No need to rewrite the problem into a form that quadprog can solve. Use lsqlin (optimization toolbox also). It does exactly what you wish.

2 件のコメント

maagen
maagen 2015 年 7 月 2 日
Ah, yeah, I just need to redefine |Cx-d|||^2 as |Qx-e|||^2 where Q=W^½C, e=W^½d, and W^½ is the matrix square root of my weighting matrix, right?
John D'Errico
John D'Errico 2015 年 7 月 2 日
Yes. Of course, if the weights are just a vector w, then diag(sqrt(w)) will suffice to build the multiplier. And if you have a big problem, then I would either make the W matrix a sparse one for faster multiplies, or I would use bsxfun to scale the rows of C. These are all minor issues unless you have a big problem or you are solving many such problems.

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

カテゴリ

タグ

質問済み:

2015 年 7 月 2 日

コメント済み:

2015 年 7 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by