Contoh Soal :
1. Ubah persamaan liner berikut menjadi persamaan matriks dan cari nilai x1, x2, x3, dan x4 !
2x1 + x2 + 4x3 + 5x4 = 8
x1 – 2x2 - 1x3 + 5x4 = 4
9x1 + 3x2 + 3x3 + 4x4 = 10
4x1 + 3x2 + 7x3 – 1x4 = 47
Jawab :
>> A = [2 1 4 5 ; 1 -2 -1 5 ; 9 3 3 4 ; 4 3 7 -1]
A =
2 1 4 5
1 -2 -1 5
9 3 3 4
4 3 7 -1
>> B = [8;4;10;47]
B =
8
4
10
47
>> C = inv(A)*B
C =
5.9000
-17.3000
10.0000
-5.3000
Maka Nilai-nilai dari x1,x2,x3dan x4 adalah:
>> x1=5.9000;x2=-17.3000;x3=10.0000;x4=-5.3000;
>> X=[x1;x2;x3;x4]
X=
5.9000
-17.3000
10.0000
-5.3000