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

MATLAB 3 equations and 3 unknowns

  1. Mar 24, 2013 #1

    I have never really used MATLAB before, and I was assigned some homework on it. While I was able to solve most of them, I was unable to solve this one in particular, even after searching the internet and documentation, there was many kinds that I was left confused.

    Does anyone know the syntax for this general case:

    ix+jy+kz=l (<- awesome I got vector components to match with x,y,z)

    And I'd like to solve for x, y, z.

    This is what I tried:

    A = [a,b,c;e,f,g;i,j,k]
    b = [d;h;l]

    and then A/b.

    This gives me three numbers (in my case, I'm not using letters)

    Is this the correct approach?

    All help is appreciated.
  2. jcsd
  3. Mar 24, 2013 #2

    I think the correct way is A\b , which is equivalent to inv(A)*b.

    Have a good day,
  4. Mar 24, 2013 #3
    You could use
    Code (Text):
    rref([A b])
    If there is a unique solution, the answer should be the identity matrix with an extra column on the right, which contains the solutions for x, y, and z.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook