필터 지우기
필터 지우기

How can I solve the least square minimization Ax=b when b is unknown?

조회 수: 2 (최근 30일)
Hi all,
I'm new in the forum. I've been thinking to this problem for a long time, so any suggestion would be appreciated. I've the following problem:
I have this equation
E p = d, where
E = (x1, y1, z1;
x2, y2, z2;
x3, y3, z3;
x4, y4, z4)
p = (a; b; c)
d = (d; d; d; d)
I want to find p using the least square minimization, but also d is unknown.
Do you have any suggestion?
Thank you
Valentina
  댓글 수: 1
Star Strider
Star Strider 2015년 3월 28일
편집: Star Strider 2015년 3월 28일
Tell us more about what created that problem. Maybe that will suggest a solution.

댓글을 달려면 로그인하십시오.

채택된 답변

Roger Stafford
Roger Stafford 2015년 3월 28일
편집: Roger Stafford 2015년 3월 28일
Whatever the value of d is, the following will give the least squares approximation for E*p-[d;d;d;d] = 0.
x = [x1;x2;x3;x4];
y = [y1;y2;y3;y4];
z = [z1;z2;z3;z4];
A = [sum(x.^2),sum(x.*y),sum(x.*z);
sum(x.*y),sum(y.^2),sum(y.*z);
sum(x.*z),sum(y.*z),sum(z.^2)];
p = d*(A\[sum(x);sum(y);sum(z)]);
where p = [a;b;c].

추가 답변 (3개)

John D'Errico
John D'Errico 2015년 3월 29일
편집: John D'Errico 2015년 3월 29일
I would point out that the solution is simply a multiple of p1, where p1 is given as the solution of:
E*p1 = ones(4,1)
Think of p1 as the solution for d=1. So solve for p1 as
p1 = E\ones(4,1);
Then despite the fact that you don't know d, the solution is simply
syms d
p = d*p1
Fairly trivial. Of course, that leaves the solution defined in terms of d as a parameter. If you then decided on the value of d, it simply scales p1 to give your answer.
If the goal is to solve for d also, then by moving d into the set of unknowns, now we have:
phat = [a;b;c;d]
Ehat = [x1, y1, z1, -1;
x2, y2, z2, -1;
x3, y3, z3, -1;
x4, y4, z4, -1];
(This is essentially what Matt did, but he missed a sign on d when he moved it to the left hand side.) Now you will be solving the homogeneous problem
Ehat*phat = 0
If the Ehat matrix is of less than full rank (i.e., it is singular), then a non-degenerate solution always exists. We can get the solution from the nullspace of Ehat. Thus the columns of null(Ehat) will yield a pair of vectors that spans the solution set.
For example:
E = [1 2 3;4 5 6;7 8 9;10 11 13]
rank(E)
ans =
3
Ehat = [E,-ones(4,1)]
Ehat =
1 2 3 -1
4 5 6 -1
7 8 9 -1
10 11 13 -1
rank(Ehat)
ans =
3
phat = null(Ehat)
phat =
0.57735
-0.57735
3.2752e-15
-0.57735
In fact, any scalar multiple of this vector is also a solution. So here we have
phat = phat/phat(1)
phat =
1
-1
5.6727e-15
-1
We can now extract a,b,c,d from the above phat vector.
However, if I change E slightly,
E = [1 2 3;4 5 6;7 8 9;10 11 12];
Ehat = [E,-ones(4,1)];
rank(Ehat)
ans =
2
Ehat now has rank 2, so the solution takes on the form of any linear combination of the columns of phat.
phat = null(Ehat)
phat =
-0.50648 -0.27714
0.78363 -0.22934
-0.27714 0.50648
0.22934 0.78363

Valentina
Valentina 2015년 3월 28일
Thank you both for your answer.
Roger in your solution how should d be defined?
Because if I don't define d, I will get the error: Undefined function or variable 'd'.
Thank you again.
Valentina
  댓글 수: 1
Roger Stafford
Roger Stafford 2015년 3월 28일
Valentina, there is absolutely no way of obtaining a least squares solution to your problem without knowing the value of d. What I have given you is simply a formula for computing a least squares solution once you know d.
To ask for a specific solution without knowing d is analogous to asking for the minimum value of a set of numbers without knowing what those numbers are. It is obviously impossible.

댓글을 달려면 로그인하십시오.


Matt J
Matt J 2015년 3월 28일
편집: Matt J 2015년 3월 28일
EE = [E,ones(4,1)];
[U,S,V]=svd(EE);
p=V(:,end);

카테고리

Help CenterFile Exchange에서 Electrical Block Libraries에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by