Azzera filtri
Azzera filtri

solve the system of equations using the matrix method

21 visualizzazioni (ultimi 30 giorni)
1) solve the system of equations using the matrix method
a)
3*x1 + x2 + 5*x3 = 20
-x1 + 4*x2 = 0
2*x1 + 3*x2 - x3 = 7
b)
x1 + 5*x2 + x3 = 28
7*x1 + 3*x2 + x3 = 54
2*x1 - 5*x2 +x3 =-31
c)
4*x1 + 2*x2 + x3 = 18
4*x2 - x3 = -2
2*x1 + 3*x2 = 6
d)
2*x1 + 3*x2 + x4 = 8
2*x1 + x2 + 4*x3 + 2*x4 = 19
4*x1 + 2*x2 +x3 - 13 = 0
4*x2 - x3 +3*x4 = 4

Risposte (1)

Sarvesh Kale
Sarvesh Kale il 8 Mar 2023
Hi Connor,
start by writing the equations in matrix format ,
a.)
A = [3 1 5 ;...
-1 4 0 ; ...
2 3 -1
];
b = [20;...
0;...
7];
x= A\b
x = 3×1
3.2353 0.8088 1.8971
b.)
A = [1 5 1;...
7 3 1;...
2 -5 1];
b= [28;54;-31];
x = A\b
x = 3×1
6.5172 6.5517 -11.2759
c.)
A = [4 2 1; 0 4 -1; 2 3 0];
b = [18;-2;6];
x= A\b % the A matrix is singular i.e the determinant is zero
Warning: Matrix is singular to working precision.
x = 3×1
Inf -Inf -Inf
d.)
A = [2 3 0 1;2 1 4 2;4 2 1 0;0 4 -1 3];
b = [8;19;13;4];
x= A\b
x = 4×1
2 1 3 1
I hope this helps !

Categorie

Scopri di più su Mathematics in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by