Cody

# Problem 895. Generate N equally spaced intervals between -L and L

Solution 2981674

Submitted on 23 Sep 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
y = your_fcn_name(100,100); assert( y(1) == -100 && y(end) == 100 && mean(diff(y))== 2 && std(diff(y)) == 0 );

y = Columns 1 through 18 -100.0000 -97.9798 -95.9596 -93.9394 -91.9192 -89.8990 -87.8788 -85.8586 -83.8384 -81.8182 -79.7980 -77.7778 -75.7576 -73.7374 -71.7172 -69.6970 -67.6768 -65.6566 Columns 19 through 36 -63.6364 -61.6162 -59.5960 -57.5758 -55.5556 -53.5354 -51.5152 -49.4949 -47.4747 -45.4545 -43.4343 -41.4141 -39.3939 -37.3737 -35.3535 -33.3333 -31.3131 -29.2929 Columns 37 through 54 -27.2727 -25.2525 -23.2323 -21.2121 -19.1919 -17.1717 -15.1515 -13.1313 -11.1111 -9.0909 -7.0707 -5.0505 -3.0303 -1.0101 1.0101 3.0303 5.0505 7.0707 Columns 55 through 72 9.0909 11.1111 13.1313 15.1515 17.1717 19.1919 21.2121 23.2323 25.2525 27.2727 29.2929 31.3131 33.3333 35.3535 37.3737 39.3939 41.4141 43.4343 Columns 73 through 90 45.4545 47.4747 49.4949 51.5152 53.5354 55.5556 57.5758 59.5960 61.6162 63.6364 65.6566 67.6768 69.6970 71.7172 73.7374 75.7576 77.7778 79.7980 Columns 91 through 100 81.8182 83.8384 85.8586 87.8788 89.8990 91.9192 93.9394 95.9596 97.9798 100.0000

Assertion failed.

2   Fail
y = your_fcn_name(200,100); assert( y(1) == -100 && y(end) == 100 && mean(diff(y))== 1 && std(diff(y)) == 0 );

y = Columns 1 through 18 -100.0000 -98.9950 -97.9899 -96.9849 -95.9799 -94.9749 -93.9698 -92.9648 -91.9598 -90.9548 -89.9497 -88.9447 -87.9397 -86.9347 -85.9296 -84.9246 -83.9196 -82.9146 Columns 19 through 36 -81.9095 -80.9045 -79.8995 -78.8945 -77.8894 -76.8844 -75.8794 -74.8744 -73.8693 -72.8643 -71.8593 -70.8543 -69.8492 -68.8442 -67.8392 -66.8342 -65.8291 -64.8241 Columns 37 through 54 -63.8191 -62.8141 -61.8090 -60.8040 -59.7990 -58.7940 -57.7889 -56.7839 -55.7789 -54.7739 -53.7688 -52.7638 -51.7588 -50.7538 -49.7487 -48.7437 -47.7387 -46.7337 Columns 55 through 72 -45.7286 -44.7236 -43.7186 -42.7136 -41.7085 -40.7035 -39.6985 -38.6935 -37.6884 -36.6834 -35.6784 -34.6734 -33.6683 -32.6633 -31.6583 -30.6533 -29.6482 -28.6432 Columns 73 through 90 -27.6382 -26.6332 -25.6281 -24.6231 -23.6181 -22.6131 -21.6080 -20.6030 -19.5980 -18.5930 -17.5879 -16.5829 -15.5779 -14.5729 -13.5678 -12.5628 -11.5578 -10.5528 Columns 91 through 108 -9.5477 -8.5427 -7.5377 -6.5327 -5.5276 -4.5226 -3.5176 -2.5126 -1.5075 -0.5025 0.5025 1.5075 2.5126 3.5176 4.5226 5.5276 6.5327 7.5377 Columns 109 through 126 8.5427 9.5477 10.5528 11.5578 12.5628 13.5678 14.5729 15.5779 16.5829 17.5879 18.5930 19.5980 20.6030 21.6080 22.6131 23.6181 24.6231 25.6281 Columns 127 through 144 26.6332 27.6382 28.6432 29.6482 30.6533 31.6583 32.6633 33.6683 34.6734 35.6784 36.6834 37.6884 38.6935 39.6985 40.7035 41.7085 42.7136 43.7186 Columns 145 through 162 44.7236 45.7286 46.7337 47.7387 48.7437 49.7487 50.7538 51.7588 52.7638 53.7688 54.7739 55.7789 56.7839 57.7889 58.7940 59.7990 60.8040 61.8090 Columns 163 through 180 62.8141 63.8191 64.8241 65.8291 66.8342 67.8392 68.8442 69.8492 70.8543 71.8593 72.8643 73.8693 74.8744 75.8794 76.8844 77.8894 78.8945 79.8995 Columns 181 through 198 80.9045 81.9095 82.9146 83.9196 84.9246 85.9296 86.9347 87.9397 88.9447 89.9497 90.9548 91.9598 92.9648 93.9698 94.9749 95.9799 96.9849 97.9899 Columns 199 through 200 98.9950 100.0000

Assertion failed.

3   Fail
y = your_fcn_name(2,100); assert( y(1) == -100 && y(end) == 100 && mean(diff(y))== 100 && std(diff(y)) == 0 );

y = -100 100

Assertion failed.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!