How do I solve a constrained linear least squares problem where the constraint depends on elements in the solution?

조회 수: 3 (최근 30일)
I have simplified the problem for ease of exposition.
I am solving for x in A*x = b. If x = [x1,x2,x3,x4], I require that x3 = (x4 - x2)./2;
My starting point was the lsqlin function, but I am unsure about how to implement the constraint.
A = [ (1+.0129*.5) 0 0 0; 0 (1+.0164) 0 0; (.0132*.5) (.0132*.5) (.0132*.5) (1+.0132*.5) ];
b = [1;1;1];
Thanks

채택된 답변

Torsten
Torsten 2016년 12월 7일
A=[ (1+.0129*.5) 0 0 0; 0 (1+.0164) 0 0; (.0132*.5) (.0132*.5) (.0132*.5) (1+.0132*.5);0 1 2 -1 ];
b=[1;1;1;0];
sol=A\b
Best wishes
Torsten.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear Least Squares에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by