Cody

Solution 2185319

Submitted on 31 Mar 2020 by Nikolaos Nikolaou
  • Size: 16
  • 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 5 10]; y =[1, 1.375, 2]; assert(isequal(minmax_map(x,1,2),y))

y = 1.0000 1.3750 2.0000

2   Pass
x=[-5 3 -65 -55 34 555 3 2 0 -5]; y =[ 187.1 198.71 100 114.52 243.71 1000 198.71 197.26 194.35 187.1]; z=abs(minmax_map(x,100,1000)-y)<0.01 assert(all(z))

y = 1.0e+03 * 0.1871 0.1987 0.1000 0.1145 0.2437 1.0000 0.1987 0.1973 0.1944 0.1871 z = 1×10 logical array 1 1 1 1 1 1 1 1 1 1

3   Pass
x = magic(3); y =[24 3 18 9 15 21 12 27 6]; assert(isequal(minmax_map(x,3,27),y))

y = 24 3 18 9 15 21 12 27 6

4   Pass
x = pascal(5); y =[-100 -100 -100 -100 -100 -100 -97.101 -94.203 -91.304 -88.406 -100 -94.203 -85.507 -73.913 -59.42 -100 -91.304 -73.913 -44.928 -1.4493 -100 -88.406 -59.42 -1.4493 100]; z=abs(minmax_map(x,-100,100)-y)<0.01 assert(all(z,'all'))

y = -100.0000 -100.0000 -100.0000 -100.0000 -100.0000 -100.0000 -97.1014 -94.2029 -91.3043 -88.4058 -100.0000 -94.2029 -85.5072 -73.9130 -59.4203 -100.0000 -91.3043 -73.9130 -44.9275 -1.4493 -100.0000 -88.4058 -59.4203 -1.4493 100.0000 z = 5×5 logical array 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

5   Pass
x=eye(5); y=[55 5 5 5 5 5 55 5 5 5 5 5 55 5 5 5 5 5 55 5 5 5 5 5 55]; assert(isequal(minmax_map(x,5,55),y))

y = 55 5 5 5 5 5 55 5 5 5 5 5 55 5 5 5 5 5 55 5 5 5 5 5 55

6   Pass
x=[4 -5 -55 -555 34; 34 34 34 -66 2]; y=[1.4745 1.4669 1.4244 1 1.5 1.5 1.5 1.5 1.4151 1.4728] z=abs(minmax_map(x,1,1.5)-y)<0.01 assert(all(z,'all'))

y = 1.4745 1.4669 1.4244 1.0000 1.5000 1.5000 1.5000 1.5000 1.4151 1.4728 y = 1.4745 1.4669 1.4244 1.0000 1.5000 1.5000 1.5000 1.5000 1.4151 1.4728 z = 2×5 logical array 1 1 1 1 1 1 1 1 1 1