Filter löschen
Filter löschen

How to get the solution of AX=b using Conjugate gradient with A non square?

5 Ansichten (letzte 30 Tage)
M.Shaarawy
M.Shaarawy am 9 Jan. 2018
Kommentiert: Jan am 9 Jan. 2018
Hi guys.. I want to solve a linear system AX=b using Conjugate gradient, with A non-square matrix (13*52),and b (13*1) with the answer must be x (52*1)???
  3 Kommentare
John D'Errico
John D'Errico am 9 Jan. 2018
Bearbeitet: John D'Errico am 9 Jan. 2018
And why do you want to solve a tiny problem using an iterative solver when several better direct approaches are available? (Why do I think the only reason that makes any sense is to do your homework?)
I'll give you a hint, one that may not be terribly useful though. Since your CG code will need a starting point for the iteration, just use the result of backslash to start it. Thus...
X0 = A\b;
The nice thing is, since it already starts out at a solution itself, the code would not need to run at all. As Matt points out, this is only one of infinitely many solutions.
Or, how about this variation? Solve the linear system
eye(52)*X = A\b
using CG iterations. The nice thing is, it is VERY well posed as a linear system.
Jan
Jan am 9 Jan. 2018
@Mohamed: What exactly is your question? What have you tried so far and which problem occurred?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

John D'Errico
John D'Errico am 9 Jan. 2018
Bearbeitet: John D'Errico am 9 Jan. 2018
Since this is surely homework, to forestall someone else just doing your homework for you, I'll give you a hint:
Tools like pcg won't solve a non-square system. So can you find a related problem, one that has the same solution, but does involve a square linear system?
Again, remember that the solution is not unique. But who cares? This is just homework. And since it is YOUR homework, you need to do the thinking, as that is all that is involved in this problem.

Community Treasure Hunt

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

Start Hunting!

Translated by