Problem 72. Interpolator
You have a two vectors, a and b. They are monotonic and the same length. Given a value, va, where va is between a(1) and a(end), find the a(n) and a(n+1) that flank it. Now interpolate the value, vb, such that it is proportionally between b(n) and b(n+1).
Note that va can land exactly on a value of a as well.
Solution Stats
Problem Comments
-
9 Comments
Show
6 older comments
Peter Orthmann
on 3 Oct 2022
The tests do not check va equal to a(1) or a(n).
Dyuman Joshi
on 4 Oct 2022
Test cases added to include for corner values as well.
Cláudio Márcio
on 7 Apr 2024
The test is broken. The question statements gives that "va" is between a(1) and a(end), but the last test gave va = a(1).
Solution Comments
Show commentsProblem Recent Solvers3384
Suggested Problems
-
Project Euler: Problem 4, Palindromic numbers
1158 Solvers
-
Back to basics 4 - Search Path
372 Solvers
-
Back to basics 17 - white space
273 Solvers
-
5625 Solvers
-
11481 Solvers
More from this Author96
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!