Cody

Problem 43301. Calculate inverse matrix in m by n matrix

Solution 3138371

Submitted on 9 Oct 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
x=(1:10)' y=3*x a=3 assert(abs(reginv(x,y)-a)<0.001)

x = 1 2 3 4 5 6 7 8 9 10 y = 3 6 9 12 15 18 21 24 27 30 a = 3 a = 0 0 0 0 0 0 0 0 0 0.3000 0 0 0 0 0 0 0 0 0 0.6000 0 0 0 0 0 0 0 0 0 0.9000 0 0 0 0 0 0 0 0 0 1.2000 0 0 0 0 0 0 0 0 0 1.5000 0 0 0 0 0 0 0 0 0 1.8000 0 0 0 0 0 0 0 0 0 2.1000 0 0 0 0 0 0 0 0 0 2.4000 0 0 0 0 0 0 0 0 0 2.7000 0 0 0 0 0 0 0 0 0 3.0000

Error using assert The condition input argument must be convertible to a scalar logical. Error in Test1 (line 5) assert(abs(reginv(x,y)-a)<0.001)

2   Fail
x=(1:10)' y=3*x+2 a=3.2857 assert(abs(reginv(x,y)-a)<0.001)

x = 1 2 3 4 5 6 7 8 9 10 y = 5 8 11 14 17 20 23 26 29 32 a = 3.2857 a = 0 0 0 0 0 0 0 0 0 0.5000 0 0 0 0 0 0 0 0 0 0.8000 0 0 0 0 0 0 0 0 0 1.1000 0 0 0 0 0 0 0 0 0 1.4000 0 0 0 0 0 0 0 0 0 1.7000 0 0 0 0 0 0 0 0 0 2.0000 0 0 0 0 0 0 0 0 0 2.3000 0 0 0 0 0 0 0 0 0 2.6000 0 0 0 0 0 0 0 0 0 2.9000 0 0 0 0 0 0 0 0 0 3.2000

Error using assert The condition input argument must be convertible to a scalar logical. Error in Test2 (line 5) assert(abs(reginv(x,y)-a)<0.001)

Suggested Problems

More from this Author27

Community Treasure Hunt

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

Start Hunting!