Question

Write a MATLAB script to Solve the following system of four linear equations using MATLAB left...

 
  • Write a MATLAB script to Solve the following system of four linear equations using MATLAB left division operator.
2w-x+5y+z=-3
3w+2x+2y-6z=-32
w+3x+3y-z=-47
5w-2x-3y+3z=49
 
  • Then using only one fprintf command, write the values you find for w, x, y and z in a text file called values.txt.
  • The values of w and x should be written in one line and values of y and z in the next line of your file.
  • The values in each line should be separated with a comma (as shown below). Show each value with three digits after decimal.
w,x
y,z
  • The script should have at the top a comment with 2-3 lines of explanation,

Homework Answers

Answer #1

clc;clear all
%%The given code solves for w,x,y and z using left division operator
%%Matrix A has the coefficients of the variables w,x,y and x
%%Matrix B has the RHS vector
%%Matrix X finds the solution
%%Output is printed as desired
A=[2 -1 5 1;3 2 2 -6;1 3 3 -1;5 -2 -3 3];
B=[-3;-32;-47;49];
X=A\B;
fprintf('Value of w is: %5.3f . Value of x is: %5.3f \n. Value of y is: %5.3f . Value of z is %5.3f',X(1),X(2),X(3),X(4))

Know the answer?
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
Similar Questions
Use Gauss-Jordan Elimination to solve the following system of equations. Please show all the wotk identifying...
Use Gauss-Jordan Elimination to solve the following system of equations. Please show all the wotk identifying what row operations you are doing in each step 2x-4y+6z-8w=-10 x-2y+z+w=2 -2x+4y+z+2w=-3 -x+3y-3z+5w=6
Solve the system of linear equations. If the system has an infinite number of solutions, set...
Solve the system of linear equations. If the system has an infinite number of solutions, set w = t and solve for x, y, and z in terms of t.) x + y + z + w = 6 2x+3y -      w=6 -3x +4y +z + 2w= -1 x + 2y - z + w = 0 x, y, z, w=?
Solve system of equations using matrices. Make a 4x4 matrix and get the diagonal to be...
Solve system of equations using matrices. Make a 4x4 matrix and get the diagonal to be ones and the rest of the numbers to be zeros 2x -3y + z + w = - 4 -x + y + 2z + w = 3 y -3z + 2w = - 5 2x + 2y -z -w = - 4
using matlab Write your own routine for Gaussian elimination without any pivoting. Input for the routine...
using matlab Write your own routine for Gaussian elimination without any pivoting. Input for the routine should consist of the number (n) of equations and the augmented matrix. Output should be the vector solution of the system. Test your code by using it to solve the following two problems: a) x + y + w + z = 10, 2x + 3y + w + 5z = 31, −x + y − 5w + 3z = −2, 3x + y...
Solve the system using either Gaussian elimination with back-substitution or Gauss-Jordan elimination.If the system has an...
Solve the system using either Gaussian elimination with back-substitution or Gauss-Jordan elimination.If the system has an infinite number of solutions, express x, y, and z in terms of the parameter t.) 3x + 3y + 9z = 6 x + y + 3z = 2 2x + 5y + 15z = 10 -x + 2y + 6z = 4 (x, y, z) = ?
Matlab: Solve the following set of simultaneous equations. Remember, the system cannot be solved if the...
Matlab: Solve the following set of simultaneous equations. Remember, the system cannot be solved if the determinant of the coefficient matrix is zero. Use if statements to only display the results if the determinant is not zero a) 3x1 + 2x2 + 4x3 = 5 2x1 + 5x2 + 3x3 = 17 7x1 + 2x2 + 2x3 = 11 b) x – y – z = 0 30x + 40y = 12 30x + 50z = 12 c) 4x +...
Use Gauss-Jordan method (augmented matrix method) to solve the following systems of linear equations. Indicate whether...
Use Gauss-Jordan method (augmented matrix method) to solve the following systems of linear equations. Indicate whether the system has a unique solution, infinitely many solutions, or no solution. Clearly write the row operations you use. (a) (5 points) x + y + z = 6 2x − y − z = 3 x + 2y + 2z = 0 (b) (5 points) x − 2y + z = 4 3x − 5y + 3z = 13 3y − 3z =...
Write the system of equations as an augmented matrix. Then solve the system by putting the...
Write the system of equations as an augmented matrix. Then solve the system by putting the matrix in reduced row echelon form. x+2y−z=-10 2x−3y+2z=2 x+y+3z=0
2. Solve the system of equations in three variables. 2x + y − 2z = −1...
2. Solve the system of equations in three variables. 2x + y − 2z = −1 3x − 3y − z = 5 x − 2y + 3z = 6
Use the simplex method to solve the linear programming problem. Maximize P = x + 2y...
Use the simplex method to solve the linear programming problem. Maximize P = x + 2y + 3z subject to 2x + y + z ≤ 14 3x + 2y + 4z ≤ 24 2x + 5y − 2z ≤ 10 x ≥ 0, y ≥ 0, z ≥ 0   The maximum is P =   at (x, y, z) = ( ) .