AAE-NA-Labs/01_Direct-Methods-for-Solving-Linear-Systems/Report/problems/Problem2.m

15 lines
228 B
Mathematica
Raw Permalink Normal View History

2023-03-11 20:08:05 +01:00
A = [1, 1, 1;
1, 1, 2;
1, 2, 2];
b = [1;2;1];
[P, Q, L, U] = Alg2(A);
% PAQ = LU
% Ly = b and Ux = y
y = Alg3(L, P*b); % Forward substitution
x = Q*Alg4(U, y) % Backward substitution
x =
1
-1
1