Cody

Solution 1693267

Submitted on 15 Dec 2018 by HH
  • Size: 9
  • This is the leading solution.
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
x = [-2 -10 5 10]; a = 0; b = 1; assert(isequal(rescale_vector(x,a,b),[0.4 0 0.75 1]))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In rescale_vector (line 2) In ScoringEngineTestPoint1 (line 3) In solutionTest (line 3)]

2   Pass
x = [-2 -10 5 10]; a = 1; b = 0; assert(isequal(rescale_vector(x,a,b),[0.6 1 0.25 0]))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In rescale_vector (line 2) In ScoringEngineTestPoint2 (line 3) In solutionTest (line 5)]

3   Pass
x = rand(10,1); a = realmin; b = realmax/1e2; y = rescale_vector(x,a,b) assert(min(y)==realmin & max(y)==b)

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In rescale_vector (line 2) In ScoringEngineTestPoint3 (line 3) In solutionTest (line 7)] y = 1

4   Pass
x = diag(pascal(10)); a = -realmax/2; b = realmax/2; y = rescale_vector(x,a,b); assert(min(y)==a && max(y)==b)

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In rescale_vector (line 2) In ScoringEngineTestPoint4 (line 3) In solutionTest (line 9)]