solve overdetermined linear system
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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?
0 Commenti
Risposte (1)
John D'Errico
il 27 Dic 2017
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 Commenti
John D'Errico
il 27 Dic 2017
Modificato: John D'Errico
il 27 Dic 2017
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.
Vedere anche
Categorie
Scopri di più su Stress and Strain in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


