Cody

Problem 1419. Find the function 2

Solution 2156057

Submitted on 10 Mar 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
M = [-2.6000 -0.0383 -1.7000 -0.1812 -1.6000 -0.2018 -1.5000 -0.2226 -1.3000 -0.2626 -0.9000 -0.3185 0.8000 0.3223 1.0000 0.3096 1.0000 0.3096 1.1000 0.2967 1.1000 0.2967 1.2000 0.2807 1.7000 0.1812 2.1000 0.1057 2.8000 0.0204] x = -3.0000; y_correct = -0.0070; assert(abs((new_point_fit2(M,x)-y_correct)/y_correct)<=0.05)

M = -2.6000 -0.0383 -1.7000 -0.1812 -1.6000 -0.2018 -1.5000 -0.2226 -1.3000 -0.2626 -0.9000 -0.3185 0.8000 0.3223 1.0000 0.3096 1.0000 0.3096 1.1000 0.2967 1.1000 0.2967 1.2000 0.2807 1.7000 0.1812 2.1000 0.1057 2.8000 0.0204 M = 2.6000 0.0383 1.7000 0.1812 1.6000 0.2018 1.5000 0.2226 1.3000 0.2626 0.9000 0.3185 0.8000 0.3223 1.0000 0.3096 1.0000 0.3096 1.1000 0.2967 1.1000 0.2967 1.2000 0.2807 1.7000 0.1812 2.1000 0.1057 2.8000 0.0204 m = 6.5252 b1 = 0.0667 b = -9.5211 y = 10.0545

Assertion failed.

2   Fail
M = [-3.0000 -0.0070 -2.8000 -0.0204 -2.0000 -0.1231 -1.1000 -0.2967 -0.7000 -0.3199 -0.5000 -0.2908 -0.2000 -0.1627 -0.2000 -0.1627 -0.2000 -0.1627 -0.2000 -0.1627 0.6000 0.3099 1.4000 0.2430 1.6000 0.2018 1.7000 0.1812 2.5000 0.0491] x = -2.1000; y_correct = -0.1057; assert(abs((new_point_fit2(M,x)-y_correct)/y_correct)<=0.05)

M = -3.0000 -0.0070 -2.8000 -0.0204 -2.0000 -0.1231 -1.1000 -0.2967 -0.7000 -0.3199 -0.5000 -0.2908 -0.2000 -0.1627 -0.2000 -0.1627 -0.2000 -0.1627 -0.2000 -0.1627 0.6000 0.3099 1.4000 0.2430 1.6000 0.2018 1.7000 0.1812 2.5000 0.0491 M = 3.0000 0.0070 2.8000 0.0204 2.0000 0.1231 1.1000 0.2967 0.7000 0.3199 0.5000 0.2908 0.2000 0.1627 0.2000 0.1627 0.2000 0.1627 0.2000 0.1627 0.6000 0.3099 1.4000 0.2430 1.6000 0.2018 1.7000 0.1812 2.5000 0.0491 m = 2.4611 b1 = 0.0667 b = -2.8886 y = 2.2797

Assertion failed.

3   Fail
M = [-2.5000 -0.0491 -1.9000 -0.1415 -1.9000 -0.1415 -1.6000 -0.2018 -1.4000 -0.2430 -1.3000 -0.2626 -1.0000 -0.3096 -0.5000 -0.2908 0.3000 0.2189 0.5000 0.2908 0.7000 0.3199 1.1000 0.2967 1.5000 0.2226 1.6000 0.2018 2.5000 0.0491] x = 0.9000; y_correct = 0.3185; assert(abs((new_point_fit2(M,x)-y_correct)/y_correct)<=0.05)

M = -2.5000 -0.0491 -1.9000 -0.1415 -1.9000 -0.1415 -1.6000 -0.2018 -1.4000 -0.2430 -1.3000 -0.2626 -1.0000 -0.3096 -0.5000 -0.2908 0.3000 0.2189 0.5000 0.2908 0.7000 0.3199 1.1000 0.2967 1.5000 0.2226 1.6000 0.2018 2.5000 0.0491 M = 2.5000 0.0491 1.9000 0.1415 1.9000 0.1415 1.6000 0.2018 1.4000 0.2430 1.3000 0.2626 1.0000 0.3096 0.5000 0.2908 0.3000 0.2189 0.5000 0.2908 0.7000 0.3199 1.1000 0.2967 1.5000 0.2226 1.6000 0.2018 2.5000 0.0491 m = 4.5210 b1 = 0.0667 b = -5.9024 y = -1.8335

Assertion failed.

4   Fail
M = [-2.3000 -0.0748 -1.8000 -0.1610 -1.6000 -0.2018 -0.9000 -0.3185 -0.3000 -0.2189 -0.3000 -0.2189 0.7000 0.3199 0.8000 0.3223 0.9000 0.3185 1.0000 0.3096 1.0000 0.3096 1.1000 0.2967 1.3000 0.2626 1.6000 0.2018 2.7000 0.0287] x = -0.5000; y_correct = -0.2908; assert(abs((new_point_fit2(M,x)-y_correct)/y_correct)<=0.05)

M = -2.3000 -0.0748 -1.8000 -0.1610 -1.6000 -0.2018 -0.9000 -0.3185 -0.3000 -0.2189 -0.3000 -0.2189 0.7000 0.3199 0.8000 0.3223 0.9000 0.3185 1.0000 0.3096 1.0000 0.3096 1.1000 0.2967 1.3000 0.2626 1.6000 0.2018 2.7000 0.0287 M = 2.3000 0.0748 1.8000 0.1610 1.6000 0.2018 0.9000 0.3185 0.3000 0.2189 0.3000 0.2189 0.7000 0.3199 0.8000 0.3223 0.9000 0.3185 1.0000 0.3096 1.0000 0.3096 1.1000 0.2967 1.3000 0.2626 1.6000 0.2018 2.7000 0.0287 m = 3.7899 b1 = 0.0667 b = -4.3862 y = -2.4912

Assertion failed.

5   Fail
M = [-2.3000 -0.0748 -1.5000 -0.2226 -1.4000 -0.2430 -1.1000 -0.2967 -0.1000 -0.0903 0.2000 0.1627 0.3000 0.2189 0.5000 0.2908 0.7000 0.3199 0.8000 0.3223 0.9000 0.3185 2.0000 0.1231 2.1000 0.1057 2.3000 0.0748 2.7000 0.0287] x = 0.9000; y_correct = 0.3185; assert(abs((new_point_fit2(M,x)-y_correct)/y_correct)<=0.05)

M = -2.3000 -0.0748 -1.5000 -0.2226 -1.4000 -0.2430 -1.1000 -0.2967 -0.1000 -0.0903 0.2000 0.1627 0.3000 0.2189 0.5000 0.2908 0.7000 0.3199 0.8000 0.3223 0.9000 0.3185 2.0000 0.1231 2.1000 0.1057 2.3000 0.0748 2.7000 0.0287 M = 2.3000 0.0748 1.5000 0.2226 1.4000 0.2430 1.1000 0.2967 0.1000 0.0903 0.2000 0.1627 0.3000 0.2189 0.5000 0.2908 0.7000 0.3199 0.8000 0.3223 0.9000 0.3185 2.0000 0.1231 2.1000 0.1057 2.3000 0.0748 2.7000 0.0287 m = 2.9743 b1 = 0.0667 b = -3.5547 y = -0.8779

Assertion failed.

6   Pass
filetext = fileread('new_point_fit2.m'); assert(isempty(strfind(filetext, 'switch'))) assert(isempty(strfind(filetext, 'while'))) assert(isempty(strfind(filetext, 'case'))) assert(isempty(strfind(filetext, 'if')))