How to find corresponding value in Y vector for a non given value in X vector?

1 view (last 30 days)
Suppose I have 2 vectors, A = [180 230 260 300 360] B = [1.2 3.2 5.6 7.9 9.1]
How do I find value of B for a value of A which is not given? For eg. A = 210.22, B = ?

Answers (1)

KSSV
KSSV on 27 Aug 2017
Do interpolation....doc interp1..
Bi=interp1(A,B,210.22)
  2 Comments
Aniket Raje
Aniket Raje on 27 Aug 2017
Hi, Thanks for your Answer. How I find for a value that is beyond the limits of the A vector? Such as 130?
KSSV
KSSV on 28 Aug 2017
It s very much given in the documentation.....I asked you to read the documentation.
Bi = interp1(A,B,130,'linear','extrap')
But note that...you should be careful with the extrapolation.

Sign in to comment.

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!