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

5 次查看(过去 30 天)
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 个评论
John D'Errico
John D'Errico 2018-1-9
编辑:John D'Errico 2018-1-9
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 2018-1-9
@Mohamed: What exactly is your question? What have you tried so far and which problem occurred?

请先登录,再进行评论。

回答(1 个)

John D'Errico
John D'Errico 2018-1-9
编辑:John D'Errico 2018-1-9
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