Linear interpolation

6.6k Views Asked by At

The blue curve is a set of (X,Y) coordinates. Orange segment passes through two of these (X,Y) coordinates (black dots of example image). Now I need a function that, regarding the orange segment, takes x value and get me the correspondent y value of the segment (green relation).

I would avoid matlab real interpolation, and I using mathematic formula. How can I do this? Example image

1

There are 1 best solutions below

1
On

On behalf of Aabaz: one can always use the two-point formula for a line joining two points $(x_1,y_1)$ and $(x_2,y_2)$:

$$\frac{y-y_1}{x-x_1}=\frac{y_2-y_1}{x_2-x_1}$$

MATLAB does support linear interpolation, BTW.