n = 5; % n is the number of variables A = zeros(n,n); % A is first filled with zeros B = zeros(n,1); % B is filled with zeros angle = pi/4; % The angle is stored in radians s = sin(angle); % The coefficients are calculated c = cos(angle); A(1,1) = -c; % Enter in the non-zero elements of A and B A(1,5) = c; A(2,1) = -s; A(2,3) = -1; A(2,5) = -s; A(3,2) = -1; A(3,4) = 1; A(4,3) = 1; A(5,4) = -1; A(5,5) = -c; B(4,1) = 10; % The solution to A*X = B could be: X= inv(A)*B % This uses the inverse X= A\B % This uses Gaussian Elimination