Borrar filtros
Borrar filtros

How to use one code to solve different system of equations?

2 visualizaciones (últimos 30 días)
Rachel Trent
Rachel Trent el 13 de Abr. de 2020
Comentada: Rena Berman el 14 de Mayo de 2020
I'm new to matlab and I'm absolutely lost of how to work this program. I'm trying to solve three different system of equations with only one code, that computes a row echelon form of any 3x4 matrix and a reduce row echelon form of any 3x4 matrix without using the rref() command. Thank you so much in advance.
The system of equations:
1. 2x1 − 3x2 + x3 = 2
−x1 − x2 + 5x3 = −2
3x1 − 2x2 − x3 = 5
2. −4x2 + 2x3 = 5
−x1 + 3x3 = 2
3x1 − 2x2 = 1
3. −4x2 + x3 = −2
−x1 − x2 + 5x3 = −3
7x1 − 2x2 = −1
  3 comentarios
Stephen23
Stephen23 el 22 de Abr. de 2020
Original question by Rachel trent, recovered from Google Cache:
"How to use one code to solve different system of equations?"
I'm new to matlab and I'm absolutely lost of how to work this program. I'm trying to solve three different system of equations with only one code, that computes a row echelon form of any 3x4 matrix and a reduce row echelon form of any 3x4 matrix without using the rref() command. Thank you so much in advance.
The system of equations:
1. 2x1 − 3x2 + x3 = 2
−x1 − x2 + 5x3 = −2
3x1 − 2x2 − x3 = 5
2. −4x2 + 2x3 = 5
−x1 + 3x3 = 2
3x1 − 2x2 = 1
3. −4x2 + x3 = −2
−x1 − x2 + 5x3 = −3
7x1 − 2x2 = −1
Rena Berman
Rena Berman el 14 de Mayo de 2020
(Answers Dev) Restored edit

Iniciar sesión para comentar.

Respuestas (1)

Anirudh Singh
Anirudh Singh el 17 de Abr. de 2020
Create augumanted matrix (A) form the euqation , then use following code :
function A = row_echelon(A)
[m,n]=size(A);
for j=1:min(m,n)
A(j,:) = A(j,:)/A(j,j);
for i = j+1:m
A(i,:)= A(i,:)- A(j,:)*A(i,j);
end
end
end
Note : This code does not work when A(j,j)=0, So try to madify logic in this code according to your requirements.

Categorías

Más información sobre State-Space Control Design and Estimation 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