Question

Using MATLAB

3. Write a MATLA code to solve the following system of linear equations: 20y 3x 1z 3

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Let's write the equations in simple form:

-x + y + 4z = -2

3x + 20y -z = 3

0x + 2y + 9z = 3

Following is the required code to solve the above problem.

% Matrix A contains the coefficients of the variables

A = [
-1 1 4
3 20 -1
0 2 9
]
  

% Matrix B contains the values at the Right Hand Side in the three equations
B = [ -2 ; 3 ; 3 ]

% compute the value for x, y, and z

solution = inv(A) * B

Here is a screenshot of the output for above code:

Default Term warning: function-/demo.m shadows a core library function -1 1 4 32?-1 2 9 2 solution = 3.29730 -0.32432 0.48541 sh-4.3$

Note: I was confused if the equations were correctly written. This is how they were in the question.

If you feel that the equations that i have written after simplifying doesn't match yours, please do COMMENT.

Hope this code meets all your requirements...

BEST WISHES!

Add a comment
Know the answer?
Add Answer to:
Using MATLAB Write a MATLA code to solve the following system of linear equations: -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
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