Question

Given the system of equations: 2 x + y + z = 2 − x +...

Given the system of equations:

2 x + y + z = 2 − x + y − z = 3 x + 2 y + 3 z = − 10

Write 3 different MATLAB scripts/instructions to solve the above system of equations.

Your answer must indicate:

  1. Solution 1: <statement(s)>
  2. Solution 2: <statement(s)>
  3. Solution 3: <statement(s)>
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution 1:

  • Define two matrices A and b of the form AX = b
  • get X by doing A\b

A = [2 1 1; -1 1 -1; 1 2 3];

b = [2;3;-10];

X = A\b

A = [2 1 1; -1 1 -1; 1 2 3]; b [2;3;-10]; X = Alb X = 3x1 3 1 -5

solution 2:

  • declare x y and z as symbols
  • declare three symbolic equations e1, e2, e3 representing the given system of equations
  • from this system of equations, get A and b matrices of AX = b using equationsToMatrix() function
  • solve for X using linsolve()

syms x y z

e1 = 2*x + y + z == 2;

e2 = -x + y -z == 3;

e3 = x + 2*y + 3*z == -10;

[A,b] = equationsToMatrix([e1, e2, e3])

X = linsolve(A,b)

syms x y z el 2*x + y + z == 2; e2 = -x + y - Z == 3; e 3 = x + 2 y + 3* z == -10; [A,b] = equationsToMatrix ([el, e2, e3]) A

solution 3:

  • using solve() to solve the system of equation e1, e2 and e3. It will return a struct with fields x, y and z. these fields contain the soltion for x, y and z respectively

syms x y z

e1 = 2*x + y + z == 2;

e2 = -x + y -z == 3;

e3 = x + 2*y + 3*z == -10;

X = solve([e1,e2,e3],[x, y, z]);

x = X.x

y = X.y

z = X.z

(D syms x y z 2*x + y + z == 2; e2 = -x + y - Z e 3 = x + 2 y + 3* z == -10; == 3 x solve (fel,e2, e3], [x, y, z]); X = X.X x

Add a comment
Know the answer?
Add Answer to:
Given the system of equations: 2 x + y + z = 2 − x +...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Given the system of equations: +y+z= -6 y - 3x = 8 2x + y +...

    Given the system of equations: +y+z= -6 y - 3x = 8 2x + y + 5z = – 19 (a) Determine the type of system: O dependent inconsistent (b) If your answer is dependent, find the complete solution. Write x, y, and z as functions of t, where z = t. If your answer is inconsistent, write DNE in the box for all three variables. 2= y = 2 =

  • Solve the given system of equations X - y (1) 5x - 72 = 30 (2)...

    Solve the given system of equations X - y (1) 5x - 72 = 30 (2) 5y + z = 10 (3) Select the correct choice below and fill in any answer boxes within your choice. OA. The solution is x= y= and z=(Type integers or simplified fractions) OB. There are infinitely many solutions. Using ordered triplets, they can be expressed as {(x,y,z)|x== z any real number) (Simplify your answers. Type expressions using z as the variable as needed) OC....

  • QUESTION 7 Solve for (x, y, z), if there is a solution to the given system...

    QUESTION 7 Solve for (x, y, z), if there is a solution to the given system of linear equations: - 4x + 2y + z = 1 X- y + 3z = -5 3x + y - 4z = 10 (-1,-3, 1)) (1,3,-1) No Solution (1,3,1)

  • QUESTION 2 Consider the system of equations: x + y + z = 3 -y +...

    QUESTION 2 Consider the system of equations: x + y + z = 3 -y + 2x + z = 0 - Z+/- 3x = 1 Choose each of the following that is a true statement about the solution of this system of equations. OAZ= -0.6 m B.V = 1.4 OC. None of the other statements is true. OD.X= 2.2 E. X= -1

  • Use the Gauss Jordan method to solve the system of equations. y=-9+x y=-1+z z=2-x Select the...

    Use the Gauss Jordan method to solve the system of equations. y=-9+x y=-1+z z=2-x Select the correct choice below and fill in any answer boxes within your choice. O A. There is one solution. The solution is in the order x, y, z. (Type an exact answer in simplified form.) O B. There are infinitely many solutions. The solution is ( 2) where z is any real number (Type an exact answer in simplified form.) O C. There is no...

  • Problem Two: (Based on Chapra, Problems 12.9 Consider the simultaneous nonlinear equations: 2-5-y y+i- 1. Plot...

    Problem Two: (Based on Chapra, Problems 12.9 Consider the simultaneous nonlinear equations: 2-5-y y+i- 1. Plot the equations and identify the solution graphically. Page 1 of 2 2. Solve the system of equations using successive substitution, starting with the initial guess xo-y-1.5. Show two complete iterations. Evaluate &s for the second iteration. 3. Redo Part 2 using Newton-Raphson method . Automate the solutions in Parts 2 and 3 using MATLAB scripts 5. Solve the system of nonlinear equations by calling...

  • Solve the following system of equations. X+ y+ z- w = 4 3x + y- z+...

    Solve the following system of equations. X+ y+ z- w = 4 3x + y- z+ w = 10 x- 4y + 32+ w = -5 -x- y+ 2+ 4w = 4 Select the correct choice below and, if necessary, fill in the answer boxes to complete your choice. O A. There is one solution. The solution is ). (Type integers or simplified fractions.) O B. There are infinitely many solutions. The solutions are ( (Type integers or simplified fractions.)...

  • 10. Given a system of equations x + y + z = 200 4x + 5y...

    10. Given a system of equations x + y + z = 200 4x + 5y + 72 = 1000 x – 2y = 0 (a) Using what you learned so far in your major, give an example of how this system of equations can be applied. (b) Without a calculator, please solve the system of equation.

  • The matrix associated with the solution to a system of linear equations in x, y, and...

    The matrix associated with the solution to a system of linear equations in x, y, and z is given. Write the solution to the system, if it exists. 1 0 -2 -9 0 1 3 6 00 0 0 Select the correct choice below and, if necessary, fill in the answer boxes to complete your choice. O A. X= and z- (Simplify your answers.) B. There are infinitely many solutions. If z is allowed to be any real number, then...

  • Solve the given system of equations. X+ y + 6z = -25 X+ y + 4z...

    Solve the given system of equations. X+ y + 6z = -25 X+ y + 4z = - 17 X-9y + 8z = 7 Select the correct choice below and fill in any answer boxes within your choice. )}. (Simplify your answers.) O A. There is one solution. The solution set is {(1 OB. There are infinitely many solutions. O C. There is no solution. Click to select and enter your answer(s). Solve the system by the method of your...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT