Cody

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

Solution 3415808

Submitted on 27 Oct 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.9697 -95.9394 -93.9091 -91.8788 -89.8485 -87.8182 -85.7879 -83.7576 -81.7273 -79.6970 -77.6667 -75.6364 -73.6061 -71.5758 -69.5455 -67.5152 -65.4848 Columns 19 through 36 -63.4545 -61.4242 -59.3939 -57.3636 -55.3333 -53.3030 -51.2727 -49.2424 -47.2121 -45.1818 -43.1515 -41.1212 -39.0909 -37.0606 -35.0303 -33.0000 -30.9697 -28.9394 Columns 37 through 54 -26.9091 -24.8788 -22.8485 -20.8182 -18.7879 -16.7576 -14.7273 -12.6970 -10.6667 -8.6364 -6.6061 -4.5758 -2.5455 -0.5152 1.5152 3.5455 5.5758 7.6061 Columns 55 through 72 9.6364 11.6667 13.6970 15.7273 17.7576 19.7879 21.8182 23.8485 25.8788 27.9091 29.9394 31.9697 34.0000 36.0303 38.0606 40.0909 42.1212 44.1515 Columns 73 through 90 46.1818 48.2121 50.2424 52.2727 54.3030 56.3333 58.3636 60.3939 62.4242 64.4545 66.4848 68.5152 70.5455 72.5758 74.6061 76.6364 78.6667 80.6970 Columns 91 through 100 82.7273 84.7576 86.7879 88.8182 90.8485 92.8788 94.9091 96.9394 98.9697 101.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 -96.9596 -93.9192 -90.8788 -87.8384 -84.7980 -81.7576 -78.7172 -75.6768 -72.6364 -69.5960 -66.5556 -63.5152 -60.4747 -57.4343 -54.3939 -51.3535 -48.3131 Columns 19 through 36 -45.2727 -42.2323 -39.1919 -36.1515 -33.1111 -30.0707 -27.0303 -23.9899 -20.9495 -17.9091 -14.8687 -11.8283 -8.7879 -5.7475 -2.7071 0.3333 3.3737 6.4141 Columns 37 through 54 9.4545 12.4949 15.5354 18.5758 21.6162 24.6566 27.6970 30.7374 33.7778 36.8182 39.8586 42.8990 45.9394 48.9798 52.0202 55.0606 58.1010 61.1414 Columns 55 through 72 64.1818 67.2222 70.2626 73.3030 76.3434 79.3838 82.4242 85.4646 88.5051 91.5455 94.5859 97.6263 100.6667 103.7071 106.7475 109.7879 112.8283 115.8687 Columns 73 through 90 118.9091 121.9495 124.9899 128.0303 131.0707 134.1111 137.1515 140.1919 143.2323 146.2727 149.3131 152.3535 155.3939 158.4343 161.4747 164.5152 167.5556 170.5960 Columns 91 through 100 173.6364 176.6768 179.7172 182.7576 185.7980 188.8384 191.8788 194.9192 197.9596 201.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 = Columns 1 through 18 -100.0000 -98.9596 -97.9192 -96.8788 -95.8384 -94.7980 -93.7576 -92.7172 -91.6768 -90.6364 -89.5960 -88.5556 -87.5152 -86.4747 -85.4343 -84.3939 -83.3535 -82.3131 Columns 19 through 36 -81.2727 -80.2323 -79.1919 -78.1515 -77.1111 -76.0707 -75.0303 -73.9899 -72.9495 -71.9091 -70.8687 -69.8283 -68.7879 -67.7475 -66.7071 -65.6667 -64.6263 -63.5859 Columns 37 through 54 -62.5455 -61.5051 -60.4646 -59.4242 -58.3838 -57.3434 -56.3030 -55.2626 -54.2222 -53.1818 -52.1414 -51.1010 -50.0606 -49.0202 -47.9798 -46.9394 -45.8990 -44.8586 Columns 55 through 72 -43.8182 -42.7778 -41.7374 -40.6970 -39.6566 -38.6162 -37.5758 -36.5354 -35.4949 -34.4545 -33.4141 -32.3737 -31.3333 -30.2929 -29.2525 -28.2121 -27.1717 -26.1313 Columns 73 through 90 -25.0909 -24.0505 -23.0101 -21.9697 -20.9293 -19.8889 -18.8485 -17.8081 -16.7677 -15.7273 -14.6869 -13.6465 -12.6061 -11.5657 -10.5253 -9.4848 -8.4444 -7.4040 Columns 91 through 100 -6.3636 -5.3232 -4.2828 -3.2424 -2.2020 -1.1616 -0.1212 0.9192 1.9596 3.0000

Assertion failed.

Suggested Problems

More from this Author56

Community Treasure Hunt

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

Start Hunting!