0
$\begingroup$

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

  • 0
    @Aabaz you should post that as an answer2011-12-07

1 Answers 1

4

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.

  • 0
    Strangely, Aabaz operation is $f$aster than linear interpolation by matlab. Running time is e-004 for interp1q and e-006 for math formula.2011-12-09