3
$\begingroup$

Is there any function that does a linear interpolation using lists?

Something where I could report a list with a number of any, as below:

data = {{161 + 15, 0}, {x1, 525 - 18}, {103.4, 525}}

$\left( \begin{array}{cc} 176 & 0 \\ \text{x1} & 507 \\ 103.4 & 525 \\ \end{array} \right)$

Some function that actually does the following interpolation procedure:

x1=data[[1,1]]+((data[[3,1]]-data[[1,1]])/(data[[3,2]]-data[[1,2]]))*data[[2,2]]

105.889

$\endgroup$
0

1 Answer 1

4
$\begingroup$

As our friend @Shadowray said in the comments

data = {{161 + 15, 0}, {x1, 525 - 18}, {103.4, 525}};

Rescale[
 data[[2, 2]], {data[[1, 2]], data[[3, 2]]}, {data[[1, 1]], 
  data[[3, 1]]}]

105.889

The image below presents the idea of Rescale: enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.