Cody

Problem 44775. Solve The Equation

Solution 2189860

Submitted on 3 Apr 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
x1=[2 2 6]; x2=[1 -1 0]; [x,y] = system_solution(x1,x2); assert(sum(abs(x-1.5))<1e-8) assert(sum(abs(y-1.5))<1e-8)

Error using \ Too many output arguments. Error in system_solution (line 2) [x,y]=[x1(1:2) x2(1:2)]\[x1(3) x2(3)]; Error in Test1 (line 3) [x,y] = system_solution(x1,x2);

2   Fail
x1=[3 2 5]; x2=[2 2 4]; [x,y] = system_solution(x1,x2); assert(sum(abs(x-1))<1e-8) assert(sum(abs(y-1))<1e-8)

Error using \ Too many output arguments. Error in system_solution (line 2) [x,y]=[x1(1:2) x2(1:2)]\[x1(3) x2(3)]; Error in Test2 (line 3) [x,y] = system_solution(x1,x2);

3   Fail
x1=[2 1 1]; x2=[4 1 6]; [x,y] = system_solution(x1,x2); assert(sum(abs(x-2.5))<1e-8) assert(sum(abs(y+4))<1e-8)

Error using \ Too many output arguments. Error in system_solution (line 2) [x,y]=[x1(1:2) x2(1:2)]\[x1(3) x2(3)]; Error in Test3 (line 3) [x,y] = system_solution(x1,x2);

4   Fail
x1=[1 1 11]; x2=[1 -1 -3]; [x,y] = system_solution(x1,x2); assert(sum(abs(x-4))<1e-8) assert(sum(abs(y-7))<1e-8)

Error using \ Too many output arguments. Error in system_solution (line 2) [x,y]=[x1(1:2) x2(1:2)]\[x1(3) x2(3)]; Error in Test4 (line 3) [x,y] = system_solution(x1,x2);

5   Fail
x1=[2 1 8]; x2=[2 -1 4]; [x,y] = system_solution(x1,x2); assert(sum(abs(x-3))<1e-8) assert(sum(abs(y-2))<1e-8)

Error using \ Too many output arguments. Error in system_solution (line 2) [x,y]=[x1(1:2) x2(1:2)]\[x1(3) x2(3)]; Error in Test5 (line 3) [x,y] = system_solution(x1,x2);

6   Fail
x1=[1 1 2]; x2=[1 -1 -2]; [x,y] = system_solution(x1,x2); assert(sum(abs(x-0))<1e-8) assert(sum(abs(y-2))<1e-8)

Error using \ Too many output arguments. Error in system_solution (line 2) [x,y]=[x1(1:2) x2(1:2)]\[x1(3) x2(3)]; Error in Test6 (line 3) [x,y] = system_solution(x1,x2);

Suggested Problems

More from this Author1

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!