Use MATLAB to solve the following problem x1 5x2 x3 6x4
Use MATLAB to solve the following problem: x_1 + 5x_2 - x_3 + 6x_4 = 19 2x_1 - x_2 + x_3 - 2x_4 = 7 -x_1 + 4x_2 - x_3 + 3x_4 = 30 3x_1 - 7x_2 - 2x_3 + x_4 = -75
Solution
Matlab code:
syms x y z w
eqn1 = x + 5*y - z+ 6*w == 19;
eqn2 = 2x - y + z - 2*w == 7;
eqn3 = -x + 4*y -z + 3*w == 30;
eqn4 = 3*x - 7*y- 2*z + w ==-75;
[A,B] = equationsToMatrix([eqn1, eqn2, eqn3, eqn4], [x, y, z,w])
X = linsolve(A,B)
