The coefficients of a system of equations are given in two vectors, x1 and x2. Write a function to solve the equation and return the answers for x and y. For example:
x1 = [2 2 6]; x2 = [1 -1 0];
2x + 2y = 6 x - y = 0
x = 1.5 y = 1.5
Solution Stats
Problem Comments
3 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers45
Suggested Problems
-
Find all elements less than 0 or greater than 10 and replace them with NaN
15808 Solvers
-
Project Euler: Problem 1, Multiples of 3 and 5
3716 Solvers
-
Back to basics 23 - Triangular matrix
1141 Solvers
-
Getting the indices from a vector
12271 Solvers
-
find the surface area of a cube
569 Solvers
More from this Author1
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
There seem to be some problems. First, in the statement of the problem, I think the correct solution is z=3, not z=4. Second, in the test problems, the function solution() is called with an argument of x. It needs to be solution(x1,x2).
... also, in test #3, the solution is compared to y_correct rather than z_correct.
The problem description and test suite have been cleaned up.