Solving Augmented Matrix: How to Use Matlab for Linear Algebra Help

In summary, to input an augmented matrix into Matlab, you can use the "matrix" function and the "cat" function or the "augmented" function. To solve an augmented matrix, you can use the "rref" function or the "inv" function. Matlab can handle systems of equations with any number of variables and you can check the correctness of your solution using the "subs" function. It can also handle complex numbers in augmented matrices using the "i" notation.
  • #1
kahless2005
46
0
I have an augmented matrix that I need to solve. I have broken it into a 4x4 matrix and a vector. As seen below.

A= 0 1 1 1; 3 0 3 -4; 1 1 1 2; 2 3 1 3

B= 0; 7; 6; 6


I have already worked the matrix out by hand using Gaussian Elimination and have obtained the solution below

Solution: 4; -3; 1; 2

How, do I enter the system into Matlab to get the same answer?
 
Physics news on Phys.org
  • #2
A= [0 1 1 1; 3 0 3 -4; 1 1 1 2; 2 3 1 3]
B= [0; 7; 6; 6]
solution=A\B
or
solution=inv(A)*B
 
  • #3


I would recommend using Matlab's built-in functions for solving linear systems. To solve the augmented matrix in Matlab, you can use the "linsolve" function. You can enter the matrix A and vector B as inputs to the function, and it will return the solution vector. Alternatively, you can also use the "inv" function to find the inverse of A and then multiply it with B to obtain the solution vector. Both methods should give you the same solution as the one you obtained by hand using Gaussian Elimination. Additionally, you can also use the "solve" function to find the symbolic solution to the system, which may be useful for more complex systems. I would also recommend checking the Matlab documentation or seeking help from a Matlab expert for further guidance on using these functions.
 

1. How do I input an augmented matrix into Matlab?

In order to input an augmented matrix into Matlab, you can use the "matrix" function to create a matrix and then use the "cat" function to concatenate the matrix with the augmented column. Alternatively, you can use the "augmented" function to directly create an augmented matrix.

2. How do I solve an augmented matrix in Matlab?

To solve an augmented matrix in Matlab, you can use the "rref" function which performs row reduction on the matrix and gives the solution in reduced row echelon form. You can also use the "inv" function to find the inverse of the coefficient matrix and then multiply it with the augmented column to get the solution.

3. Can I use Matlab to solve systems of equations with more than two variables?

Yes, Matlab can be used to solve systems of equations with any number of variables. You can input the augmented matrix into Matlab and use the "rref" function to obtain the solution in reduced row echelon form, which will give the values for all variables.

4. How do I check if my solution to an augmented matrix is correct?

You can check if your solution to an augmented matrix is correct by using the "subs" function to substitute the values obtained from the augmented matrix into the original equations. If the resulting equations are satisfied, then your solution is correct.

5. Can Matlab handle complex numbers in augmented matrices?

Yes, Matlab can handle complex numbers in augmented matrices. You can input complex numbers using the "i" notation (e.g. 2+3i) and use the "rref" function to obtain the solution in reduced row echelon form, which will also have complex numbers.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
553
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
116
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
Back
Top