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 Solvers3381
Suggested Problems
-
8970 Solvers
-
Given two arrays, find the maximum overlap
1566 Solvers
-
296 Solvers
-
Return the first and last characters of a character array
10430 Solvers
-
669 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!