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

Click For Summary
To solve an augmented matrix in Matlab, the user has defined matrix A and vector B for a 4x4 system. The correct Matlab commands to find the solution are either using the backslash operator with "solution = A\B" or by calculating the inverse with "solution = inv(A)*B". The user has already verified the solution through Gaussian Elimination, obtaining the results of 4, -3, 1, and 2. Both methods in Matlab should yield the same results as the manual calculation.
kahless2005
Messages
44
Reaction score
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
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
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 2 ·
Replies
2
Views
3K
Replies
7
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 10 ·
Replies
10
Views
3K