Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
%% simple test
x = [-2 -10 5 10];
a = 0; b = 1;
assert(isequal(rescale_vector(x,a,b),[0.4 0 0.75 1]))
|
2 | Pass |
%% inverse test
x = [-2 -10 5 10];
a = 1; b = 0;
assert(isequal(rescale_vector(x,a,b),[0.6 1 0.25 0]))
|
3 | Pass |
%% extrem positive
x = rand(10,1);
a = realmin; b = realmax/1e2;
y = rescale_vector(x,a,b)
assert(min(y)==realmin & max(y)==b)
y =
1.0e+306 *
0.1906
0.0000
1.6258
0.6061
1.7977
0.5052
1.4889
0.5198
1.5914
1.4523
|
4 | Pass |
%% extrem
x = diag(pascal(10));
a = -realmax/2; b = realmax/2;
y = rescale_vector(x,a,b);
assert(min(y)==a && max(y)==b)
|
2183 Solvers
87 Solvers
Remove the two elements next to NaN value
411 Solvers
Try 1.5.4: Celsius to Fahrenheit
609 Solvers
484 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!