function x = solveEquations()
% Coefficient matrix
A = [4 4 1 1; 2 1 2 -2; 1 1 1 -1; 1 -1 -1 2];
% Right-hand side vector
b = [11; 2; 2; 0];
% Augmented matrix
Ab = [A, b];
% Number of equations
n = size(A, 1);
% Forward elimination
for k = 1:n-1
for i = k+1:n
factor = Ab(i,k) / Ab(k,k);
Ab(i,:) = Ab(i,:) - factor * Ab(k,:);
end
end
Sure, I can help you with that. Here is the MATLAB code for solving the given linear equation system using the Gaussian elimination method:
% Back substitution
x = zeros(n, 1);
x(n) = Ab(n, n+1) / Ab(n, n);
for i = n-1:-1:1
x(i) = (Ab(i, n+1) - Ab(i,i+1:n) * x(i+1:n)) / Ab(i,i);
end
end