Cody

Problem 1366. Finding peaks

Solution 2889275

Submitted on 29 Aug 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
x = [2 12 4 6 9 4 3 1 19 7]; y_correct = [12 9 19]; assert(isequal(find_peak(x),y_correct))

Undefined function 'gradiant' for input arguments of type 'double'. Error in find_peak (line 3) y = gradiant(x); Error in Test1 (line 3) assert(isequal(find_peak(x),y_correct))

  
2   Fail
x = [ones(1,9) 10 zeros(1,10)]; y_correct = 10; assert(isequal(find_peak(x),y_correct))

Undefined function 'gradiant' for input arguments of type 'double'. Error in find_peak (line 3) y = gradiant(x); Error in Test2 (line 3) assert(isequal(find_peak(x),y_correct))

  
3   Fail
x = [1:10 100 -4 2 0 0 4 5 6 0]; y_correct = [100 2 6]; assert(isequal(find_peak(x),y_correct))

Undefined function 'gradiant' for input arguments of type 'double'. Error in find_peak (line 3) y = gradiant(x); Error in Test3 (line 3) assert(isequal(find_peak(x),y_correct))

  
4   Fail
x = [1:5 6:-1:1 1:3 4:-1:0]; y_correct = [6 4]; assert(isequal(find_peak(x),y_correct))

Undefined function 'gradiant' for input arguments of type 'double'. Error in find_peak (line 3) y = gradiant(x); Error in Test4 (line 3) assert(isequal(find_peak(x),y_correct))

  
5   Fail
x = zeros(1,10000); x(2:10:9992) = 1; y_correct = ones(1,1000); assert(isequal(find_peak(x),y_correct))

Undefined function 'gradiant' for input arguments of type 'double'. Error in find_peak (line 3) y = gradiant(x); Error in Test5 (line 3) assert(isequal(find_peak(x),y_correct))

  
6   Fail
x = [1 2 4 7 10 9 8 9 10 9 7 4 5 3 1 -2 -3 0 1 0]; y_correct = [10 10 5 1]; assert(isequal(find_peak(x),y_correct))

Undefined function 'gradiant' for input arguments of type 'double'. Error in find_peak (line 3) y = gradiant(x); Error in Test6 (line 3) assert(isequal(find_peak(x),y_correct))

  
7   Fail
x = [repmat([1 2 3 2 1],[1,1000])]; y_correct = 3*ones(1,1000); assert(isequal(find_peak(x),y_correct))

Undefined function 'gradiant' for input arguments of type 'double'. Error in find_peak (line 3) y = gradiant(x); Error in Test7 (line 3) assert(isequal(find_peak(x),y_correct))

  

Suggested Problems

More from this Author9

Community Treasure Hunt

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

Start Hunting!