Help solving systems of linear equations

4 visualizaciones (últimos 30 días)
Jesse Walters
Jesse Walters el 25 de Jul. de 2018
Editada: Jesse Walters el 25 de Jul. de 2018
I am trying to write a code to properly charge balance chemical reactions (complex redox reactions), and have run into some math issues. I am starting with a simple equation that I know the solution for:
I am trying to solve the equation Ax=B for the matrix A=[3 0 -2;4 2 -3;-1 4 0] when B=[0;0;0], the solution I am looking for is x=[4;1;6]. However, when I try to solve for x using x=A\B I get the following warning "Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 9.462128e-19." and the solution I get is x=[0;0;0].
How do I get a nonzero solution for my A matrix?
Thanks
  1 comentario
Jesse Walters
Jesse Walters el 25 de Jul. de 2018
Editada: Jesse Walters el 25 de Jul. de 2018
I solved it, if you change the matrixes to A=[3 0 -2;4 2 -3;-1 4 0;0 1 0] and B=[0 0 0 1] then it's not overdetermined and can actually be solved.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by