Problem 837. Find all the zeros of sinus , cosinus and tangent in a given interval

Solution 3153541

Submitted on 10 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
assert(all(abs(find_zeros(@sin,0,2*pi) -[0 pi 2*pi])<1e-9))

ans = 1.5708 4.7124

Matrix dimensions must agree. Error in Test1 (line 1) assert(all(abs(find_zeros(@sin,0,2*pi) -[0 pi 2*pi])<1e-9))

2   Fail
assert(all(abs(find_zeros(@sin,0,pi) -[0 pi ])<1e-9))

ans = 1.5708

Assertion failed.

3   Pass
assert(all(abs(find_zeros(@sin,0,pi/3) -0) <1e-9))

ans = []

4   Fail
assert(all(abs(find_zeros(@cos,0,2*pi) -[pi/2 3*pi/2])<1e-9))

ans = 0 3.1416 6.2832

Matrix dimensions must agree. Error in Test4 (line 1) assert(all(abs(find_zeros(@cos,0,2*pi) -[pi/2 3*pi/2])<1e-9))

5   Pass
assert(all(abs(find_zeros(@tan,0,pi/4) -0)<1e-9))

ans = []

Suggested Problems

More from this Author30

Community Treasure Hunt

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

Start Hunting!