Skip to main content
1-Visitor
November 21, 2016
Solved

How to find a value on a table and to compute another value with the linear interpolation?

  • November 21, 2016
  • 1 reply
  • 1973 views

I have a matrix which contains many values for kd, x/d, z/d, Ec1 (reinforced concrete). for a given value of u.sd for example i need to search the matrix for the first higher and lower values than the given one, and with those values , with the linear interpolation to compute the other values in other columns for the corresponding given number.

I had a similar code for C# that my brother wrote for me but since he doesn't know how mathcad works i can't translate into mathcad functions. I will try to explain with a picture:

Screenshot_1.jpg

Best answer by Werner_E

This is how it would work using the built-in routine for linear interpolation (you could also chose cubic spline interpolation).

But it fails, because your table includes a lot of equal values in the mu.sd column, e.g.:

What should be the value for k.d (last column), when mu.sd is 0.154? Should it be 2.545, or 2.549 or 2.552 ?

Mathcad can't know and so it fails.

You would either have to provide values with more precision, at least for mu.sd so that all values in that column are different, or you must consolidate lines with equal mu.sd value into one line - maybe chosing the average of all values in the other columns. This could be done using a small Mathcad program.

WE

1 reply

Werner_E25-Diamond IAnswer
25-Diamond I
November 21, 2016

This is how it would work using the built-in routine for linear interpolation (you could also chose cubic spline interpolation).

But it fails, because your table includes a lot of equal values in the mu.sd column, e.g.:

What should be the value for k.d (last column), when mu.sd is 0.154? Should it be 2.545, or 2.549 or 2.552 ?

Mathcad can't know and so it fails.

You would either have to provide values with more precision, at least for mu.sd so that all values in that column are different, or you must consolidate lines with equal mu.sd value into one line - maybe chosing the average of all values in the other columns. This could be done using a small Mathcad program.

WE

1-Visitor
November 22, 2016

Perfect.. It works great now.

Thank you very much