solve overdetermined linear system

Hello. I need to solve overdetermined linear system A*x=B, where x is [a1 a2 a3 a4 a5]. I got a solution with command
inv(A'*A)*A'*B;
but the answer is not what I need, because i have a theoretical solution for this problem. Can I somehow set the initial approximation to get the solution I need?

回答(1 个)

First of all, DON'T USE THAT SOLUTION!!!!!!!! That is a bad idea, because it is terrible when applied to moderately ill-posed problems.
Instead, use
coef = A\b;
This will be more accurate.
You say that the answer is not what you wanted. Too bad. You cannot set an initial start point for a problem that has a unique solution.
An alternative solution is to use lsqr.
coef = lsqr(A,b);
You can set the start point for lsqr. From the help for lsqr...
X = lsqr(A,B,TOL,MAXIT,M1,M2,X0) specifies the P-by-1 initial guess. If
X0 is [] then lsqr uses the default, an all zero vector.
But as long as A is full rank, then you will get the same solution, no matter what the start point.
So, is A of less than full rank? If so, then the solution is non-unique, and there are infinitely many equally good solutions.
If you have additional information about the problem, then you need to explain what it is.

5 个评论

Yes, rank(A)=2, but i got same solution. I tried this:
x01 = 30*ones(nr-1,1);
lsqr(A,B,[],30,[],[],x01)
I have theoretical solution. This is K1=a1*sqrt(2*pi), so a1=K1/sqrt(2*pi)=31,... Becouse theoretical solution is 31, i set x0 as vector of 30, but solution is 1.2639
You have told me only that A has rank of 2. Not what the size of A is. IS A FULL RANK? How many times must I ask that?
Ok, so your call to lsqr tells me that A has nr-1 columns. Of course, you do not tell me what nr is.
Then you tell me that A has rank 2. Before, you told me the problem is over determined. Therefore there are more than nr-1 rows in A. But is nr 3? If it is, then A is of full rank.
IF A IS FULL RANK, THEN THERE IS ONLY ONE SOLUTION. IT IS UNIQUE. So it really does not matter what method you use on a full rank matrix A. Just wanting a different solution is irrelevant, at least unless you possess good wanding skills. How is your magic?
So if you want help, then best would be to provide the matrix A and vector B. Put them in a .mat file, and attach it to a comment using the paper clip. Then explain why you think that the solution you have posed is a solution. You have claimed theory here, but that does not mean I have any reason to believe or accept your claim. Perhaps your theory is even correct, but you created the matrices A or B incorrectly.
Sorry, i understand you, i have bad English. Size of A is 30 or 40 by 2 or 3 or 4, depends on the number of points and on the number of terms in the sum. tochki2 - points from experimental picture
No, nr is number of members in sum, so nr is 3, 4 or 5
I cannot run your code though, because I do not know what input to provide.
Your .mat file does not contain A and B, which is all that we need here for the moment.
But if A has rank 2 AND it has 2 columns, then this explains why you get the same answer from both backslash and lsqr. It will be of full rank. If A had 3 or 4 columns and 30-40 rows, and still was rank 2, then backslash and lsqr can return different results, because there will be infinitely many results. So I think you are trying the case where A has 2 columns.
But how i can make the rank of A is 3 or 4, when i take like 3 members in sum? I take for example 40 point, 3 members and 223 MPa of stress. Ok. I finding K1 which is mode I stress-intensity factors by solve this system
The left side of expression is stress from ANSYS and F1n is (q=n/2):
. K1=a1*sqrt(2*pi). In theory K1=Sigma*sqrt(2*pi*l), where l is lenght of fracture, Sigma is the tensile load value. So theta and r i got from picture of stress intensity from ANSYS.
This theory is described in Interference-optical Methods of Solid Mechanics by Razumovsky, Igor A.

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Stress and Strain 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by