Problem 17. Find all elements less than 0 or greater than 10 and replace them with NaN
This is a poorly posed problem. There are no numbers that are both less than zero and greater than 10.
Just had the same thought as James Ross...
Fixed the wording to reflect this. Thanks for the comments.
come on wth is this problem i got wrong when i check my answer is true
Can someone explain this to me?
cleanUp=@(lb,x)interp1([lb 10],[lb 10],x);x=[5 17 -20 99 3.4 2 8 -6];y_correct=[5 NaN NaN NaN 3.4 2 8 NaN];
That is, if i set the lower bound (lb) of the interpolation to 1 it passes the test code but if I set it to zero it fails with the same output!?!
The 3.4 in the result isn't the same in the two interpolations (diff= 4.440892098500626e-16). It's small but it's enough to fail the isequal test.
16 is the first non-regexp-solution!
I have Assertion failure for the first test but it's good for the second --' I don't understand. Can you help me ?
More usefull than I thougth
good problem to learn!
Solution CommentsShow comments
Problem Recent Solvers14886
More from this Author96
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!