Problem 378. Inhomogenous Depth Scale Interpolation
- The depth array, Z, will always start at 0 and end at 1, which are also the bounds of the target depth d. This is so that you do not have to handle "edge" cases.
- The depth array, Z, will always be sorted in the third dimension.
- Both input arrays will be the same size.
- The test cases are randomly generated and your solution is tested against a simple for-looping code.
Solution Stats
Problem Comments
-
2 Comments
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).
The test suite has been updated to not use isequal().
Solution Comments
Show commentsProblem Recent Solvers7
Suggested Problems
-
Find the numeric mean of the prime numbers in a matrix.
8529 Solvers
-
Find all elements less than 0 or greater than 10 and replace them with NaN
15176 Solvers
-
Sort a list of complex numbers based on far they are from the origin.
5435 Solvers
-
Make a run-length companion vector
625 Solvers
-
Calculate the area of a triangle between three points
2578 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!