Cody

# Problem 44946. Solve a System of Linear Equations

Solution 3866978

Submitted on 26 Nov 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
theta = 2*pi; x_correct = [1; 1]; assert(sum(abs((solve_lin(theta)-x_correct)))< 1e-5)

A = 1.0000 0.0000 -0.0000 1.0000 b = 1 1 x = 1.0e+15 * 0.0000 4.0828 -4.0828 0.0000

Error using assert The condition input argument must be convertible to a scalar logical. Error in Test1 (line 3) assert(sum(abs((solve_lin(theta)-x_correct)))< 1e-5)

2   Fail
theta = pi; x_correct = [-1; -1]; assert(sum(abs((solve_lin(theta)-x_correct)))< 1e-5)

A = -1.0000 -0.0000 0.0000 -1.0000 b = 1 1 x = 1.0e+15 * -0.0000 -8.1656 8.1656 -0.0000

Error using assert The condition input argument must be convertible to a scalar logical. Error in Test2 (line 3) assert(sum(abs((solve_lin(theta)-x_correct)))< 1e-5)

3   Fail
theta = -0.5; x_correct = [1.357;0.3982]; assert(sum(abs((solve_lin(theta)-x_correct)))< 1e-4)

A = 0.8776 0.4794 -0.4794 0.8776 b = 1 1 x = 1.1395 2.0858 -2.0858 1.1395

Error using assert The condition input argument must be convertible to a scalar logical. Error in Test3 (line 3) assert(sum(abs((solve_lin(theta)-x_correct)))< 1e-4)

### Community Treasure Hunt

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

Start Hunting!