Cody

Solution 417678

Submitted on 13 Mar 2014 by Zikobrelli
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   Pass
%% lb = 0; ub = 10; d = 1; val = 3; y_correct = [0 1 2 3 4 5 6 7 8 9 10]; assert(isequal(equidistant_points(lb, ub, d, val), y_correct))

y = Columns 1 through 16 2 1 0 -1 -2 -3 -4 -5 -6 -7 3 4 5 6 7 8 Columns 17 through 21 9 10 11 12 13 ans = 0 1 2 3 4 5 6 7 8 9 10

2   Pass
%% lb = 0; ub = 10; d = 2; val = 5; y_correct = [1 3 5 7 9]; assert(isequal(equidistant_points(lb, ub, d, val), y_correct))

y = Columns 1 through 16 3 1 -1 -3 -5 -7 -9 -11 -13 -15 5 7 9 11 13 15 Columns 17 through 21 17 19 21 23 25 ans = 1 3 5 7 9

3   Pass
%% lb = 0; ub = 10; d = 2.2; val = 6.1; y_correct = [1.7 3.9 6.1 8.3]; assert(max(abs(equidistant_points(lb, ub, d, val) - y_correct)) < 1e-15)

y = Columns 1 through 9 3.9000 1.7000 -0.5000 -2.7000 -4.9000 -7.1000 -9.3000 -11.5000 -13.7000 Columns 10 through 18 -15.9000 6.1000 8.3000 10.5000 12.7000 14.9000 17.1000 19.3000 21.5000 Columns 19 through 21 23.7000 25.9000 28.1000 ans = 1.7000 3.9000 6.1000 8.3000

Suggested Problems