Problem 378. Inhomogenous Depth Scale Interpolation
Solution Stats
Problem Comments
-
1 Comment
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).
Solution Comments
-
2 Comments
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.
Problem Recent Solvers7
Suggested Problems
-
middleAsColumn: Return all but first and last element as a column vector
487 Solvers
-
17 Solvers
-
Create a matrix X, where each column is a shifted copy of the vector v
169 Solvers
-
261 Solvers
-
4865 Solvers
More from this Author56
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!