I think test case 2 might be incorrect.
I disagree slightly with the expected solution to test 2.
Test 2 cos between [0 2pi]
[-pi/2 pi/2 3*pi/2]
I do not believe that -pi/2 is in the interval [0 2*pi].
If -pi/2 is desired then the answer to sin [0 2*pi] should be [-2*pi -pi 0 pi 2*pi]
Correction of assert function.
One of the ")" is in the wrong place.
assert(all(abs(find_zeros(@sin,0,2*pi) -[0 pi 2*pi]<1e-9)))
assert(all(abs(find_zeros(@sin,0,2*pi) -[0 pi 2*pi])<1e-9))
As mentioned by others, the 2nd test case is incorrect, -pi/2 is outside the interal [0,2*pi] for the function cosine. And if we do plot cos(x) on said interval, we notice that the cosine function crosses the x-axis only twice.
The –pi/2 has been removed from that test case.
Yeah, the test set is wrong...
Return the 3n+1 sequence for n
Extract leading non-zero digit
letter yes yes & letter no no
Put two time series onto the same time basis
Set some matrix elements to zero
Cody Computer Part 5 - Guess the Name of Cody Computer
Convert a numerical matrix into a cell array of strings
Remove the two elements next to NaN value
Fill a zeros matrix
Get the elements of diagonal and antidiagonal for any m-by-n matrix
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office