selecting an element of a vector
Show older comments
How to select an element of a vector which is nearest to the given value xp.
Suppose we have a vector
x=[1 1.05 1.1 1.15 1.2 1.25]
a) if xp=1.18, the output should be 1.2 (which is nearest to 1.18)
b) if xp=1.12, the output should be 1.1 (which is nearest to 1.12)
2 Comments
madhan ravi
on 23 Oct 2018
Edited: madhan ravi
on 23 Oct 2018
b) if xp=1.12, the output should be 1.1 (which is nearest to 1.12)
nearest to 1.12 is 1.15 ?? not 1.1 , whats the logic behind it ,explain to understand
PJS KUMAR
on 23 Oct 2018
Accepted Answer
More Answers (1)
PJS KUMAR
on 25 Oct 2018
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!