Cody

Solution 1605480

Submitted on 10 Aug 2018 by Jiahang Li
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 = 0:0.01:pi; y = sin(x); y_correct = 1.57; assert(abs(argmax(x,y) - y_correct) < 0.01 )

ans = 1.5700

2   Pass
x = 0:0.01:pi; y = x.^2; y_correct = 3.14; assert(abs(argmax(x,y) - y_correct) < 0.01 )

ans = 3.1400

3   Pass
x = 0:0.01:pi; y = -(x-.42).^2; y_correct = .42; assert(abs(argmax(x,y) - y_correct) < 0.01 )

ans = 0.4200

4   Pass
x = -100:0; y = -cosh(x+3); y_correct = -3; assert(abs(argmax(x,y) - y_correct) < 0.01 )

ans = -3

Suggested Problems

More from this Author2