Skip to main content
12-Amethyst
April 15, 2021
Solved

How to linearly interpolate from a table

  • April 15, 2021
  • 2 replies
  • 3947 views

I need to linearly interpolate from a table, which I attached with some examples.
I appreciate any help... Thanks a lot!

Best answer by LucMeekes

We had almost feared you had lost interest.

Anyway, I guess what you need can still be done with linterp, it just requires an addition to the table at both sides you add a column with repeating values. See attached.

 

Success!
Luc

2 replies

23-Emerald IV
April 15, 2021

Did you already have a look here?

https://community.ptc.com/t5/PTC-Mathcad/Interpolation-of-Table-Values/td-p/721321

 

Anyway, attached is a sheet that should work for you.

 

Success!
Luc

12-Amethyst
April 29, 2021

Thanks @LucMeekes and @Fred_Kohlhepp for your efforts! ... Nice work

Sorry, I was away for over a week, and I did not have the chance to check earlier.

The solution that @LucMeekes has provided works perfect, BUT, I do not want to extrapolate beyond the boundaries. Just stick to the minimum or the maximum if the interpolated value goes beyond the limits. Otherwise works fantastic! 

The solution that @Fred_Kohlhepp has provided works perfect for not performing the extrapolation, but works only the SiteClass "B" and does not change automatically if I change the class to "D" for instance.
Looks like the row position is "hard coded" but I need it more dynamic to perform the lookup by changing the SiteClass to any other letter in the list...

Thanks guys, I learn from both of you!

LucMeekes23-Emerald IVAnswer
23-Emerald IV
April 29, 2021

We had almost feared you had lost interest.

Anyway, I guess what you need can still be done with linterp, it just requires an addition to the table at both sides you add a column with repeating values. See attached.

 

Success!
Luc

23-Emerald I
April 16, 2021

Have a great care!

 

From your example there is a problem.  There is a command (linterp) that will do what you ask, EXCEPT it will not extrapolate beyond the limits of your data.  Your example has points beyond that range, and will require some thought.

 

Fred_Kohlhepp_0-1618577066711.png

 

 

(Linterp is developed to do the same thing as the Mathcad "premium feature" linterp.

23-Emerald IV
April 16, 2021
Fred,
The function linterp does extrapolate as well as interpolate. From Prime (4) help:
LucMeekes_0-1618577747916.png

The extrapolation doesn't produce the answers that the OP expected though:

LucMeekes_0-1618577986108.png

 

Luc

 
 
23-Emerald I
April 16, 2021

The extrapolation doesn't produce the answers that the OP expected though:

 

Beg to differ!

Fred_Kohlhepp_0-1618599434350.png

That's why I made f(x,X,Y)