Cody

Problem 45443. Generate n equally spaced "intervals" between -x and x (★)

Solution 2207868

Submitted on 13 Apr 2020 by Binbin Qi
  • 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 = 5; n = 4; y_correct = [-5 -2.5 0 2.5 5]; assert(isequal(spaced_intervals(x,n),y_correct))

2   Pass
x = 9; n = 5; assert(std(diff(spaced_intervals(x,n)))<1e-10)

Suggested Problems

More from this Author46

Community Treasure Hunt

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

Start Hunting!