Is there a way to solve singular matrix on MATLAB

  • Thread starter Thread starter Dell
  • Start date Start date
  • Tags Tags
    Matlab Matrix
Click For Summary
To solve a singular matrix in MATLAB, one can use the Row Reduced Echelon Form (RREF) method to find a general solution. Rearranging the matrix and augmenting it with the constants allows for the identification of relationships between variables. In the example provided, the RREF shows that the system has infinitely many solutions expressed in terms of a free variable. The relationships derived are x = x, y = 5 - 2x, and z = 2 - x. This method effectively provides a way to express solutions for singular matrices.
Dell
Messages
555
Reaction score
0
if i have a matrix which i singular, and i need to find a general solution to it, is there a way to do this using linsolve or any other command,

for example, if i have

2x+y=5
x+z=2
3x+y+z=7

is there any way i can get a solution of
x=x
y=5-2x
z=2-x
 
Physics news on Phys.org
Rearrange your matrix in reverse order:

Code:
  z y x
[ 0 1 2 ]
[ 1 0 1 ]
[ 1 1 3 ]

Then augment it:

Code:
  z y x
[ 0 1 2 5 ]
[ 1 0 1 2 ]
[ 1 1 3 7 ]

Then you need to calculate the Row Reduced Echelon Form:

Code:
  z y x
[ 1 0 1 2 ]
[ 0 1 2 5 ]
[ 0 0 0 0 ]

From this you can see that x=x (bottom row), and y = 5 - 2x (second row) and z = 2 - x (first row).
 

Similar threads

Replies
2
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 18 ·
Replies
18
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 18 ·
Replies
18
Views
3K