LSE

版本 1.1.0.0 (4.6 KB) 作者: John D'Errico
A linear least squares solver, subject to linear equality constraints
6.0K 次下载
更新时间 2010/6/30

查看许可证

This submission was written by request - as a tool to handle linear least squares problems, subject to linear equality constraints that may potentially be rank deficient. (It handles problems with full rank constraints of course too.) In the event of a rank deficient constraint system, it tests for consistency of the constraints.

I added a few other features to LSE:

- It allows multiple right hand sides to the least squares problem, fully vectorized of course.
- Weights may be supplied.
- You are offered a choice of least squares solvers, either backslash or pinv.

LSE solves the problem (for an unknown vector x)

argmin norm(A*x - b)

subject to the constraints

C*x = d

As an example, consider the random system
A = rand(10,3);
b = rand(10,1);

With a rank deficient constraint set
C = [1 1 1;1 1 1];
d = [1;1];

X = lse(A,b,C,d)
X =
0.5107
0.57451
-0.085212

Verify that the constraints are satisfied

C*X
ans =
1
1

Column pivoting is used to eliminate variables from the constraint system when \ is specified, and when pinv is specified, an svd is used for the final solution.

引用格式

John D'Errico (2024). LSE (https://www.mathworks.com/matlabcentral/fileexchange/13835-lse), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2006b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Linear and Nonlinear Regression 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.1.0.0

Bug fix - Single constraint problems on R2009 releases failed due to a qr issue - this fix repairs that bug.