Please, bmtran, don't use isequal with floats, prefer to use abs(a-b) < tol. Unless I use the function interp1 exactly like you did, my solution cannot pass the test suite. Please try my commented code (and the difference between the solutions is at the order of 1e-15).
perhaps you could specify a target numerical precision? (isequal on floats can be flaky)
Alfonso's solution suffers from the same problem of precision apparently. Using isequal requires that one does the exact same operation that you did (to obain the exact same error*), and closes the door for alternative or smaller solutions.
* Floating-point numbers have some precision problems: the classic example is 0.1 which becomes an infinite number as a binary.
Find all elements less than 0 or greater than 10 and replace them with NaN
13139 Solvers
Remove any row in which a NaN appears
6866 Solvers
Back to basics 17 - white space
247 Solvers
Compress strings (not springs)
103 Solvers
349 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!