Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Solve XA=Y

  1. Oct 27, 2009 #1
    I have a system of linear equations which can be expressed as XA=Y where X and Y are row vectors. The vector Y and the matrix A are given. I need to solve for X.
    I can rephrase the same equation as AtXt=Yt but the answer will still be the same.

    I try using matlab to solve for X using the commands X=Y/A or X=Y*inv(A). Matlab do give an answer but it comes with the message

    "Warning: Matrix is close to singular or badly scaled.
    Results may be inaccurate. RCOND = 2.336280e-028. "

    I have check that the determinant of A is not zero although it is near zero. Hence A is not singular. The problem may be due to condition number of the matrix A, I think. What does the RCOND in the message meant?

    If I still want to solve the equation although the matrix is badly condition, what a better method should I use?
  2. jcsd
  3. Oct 28, 2009 #2


    Staff: Mentor

    Here's a link to a page for matlab's rcond function: http://www.nacs.uci.edu/dcslib/matlab/matlab-v53/help/techdoc/ref/rcond.html [Broken]
    Last edited by a moderator: May 4, 2017
  4. Oct 31, 2009 #3
    rcond is the reciprocal of the condition of A. Thanks Mark. So my matrix A is badly condition. The answer obtained is not reliable. However not much I can do about it because the matrix A is a given matrix with entry number in the range [0,1]. In my work (i discretize pde) I only change Y.

    Is there any hope for me, say using other method, to solve the equation with reliable answer?

    I see there is also a thread on Condition number.

    I will be following that also, in case there are helpful response.
  5. Nov 2, 2009 #4
    I'm from that thread you linked. My method of solving a poorly conditioned system is to use a nonlinear solver.

    If you have a system Ax = b then you can program a function in matlab to take an input of x and the output would be Ax - b.

    I.E. F(x) = Ax - b (which ideally equals 0 for the desired value of x).

    In this case, you'd want to find the zeros of F to find the solution to x. Matlab's built in fsolve function works well here. Be warned though, as was the case in my problem, since the matrix A is poorly conditioned, yes it will give you a solution but it may not be a good solution.
  6. Nov 2, 2009 #5
    I hope you don't mind that I put the link to your thread here. Now I can understand better what you had written in your previous post (the one at your started thread).

    The only nonlinear numerical method that I know is the Newton-Raphson method (NR). I do not know what algorithm is behind the matlab nonlinear solver fsolve().

    The NR that I know required an initial estimation for the zero because nonlinear equation in general can have more than one root. This is an extra information that we have to supply which we shouldn't be doing because our equations have only one zero.

    Also the algorithm behind the NR still required it to solve system of linear equations. So it back to square one, the problem with the condition number.

    ps. Actually to which forum should I post questions on numerical method?
  7. Nov 3, 2009 #6
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook