Skip to main content
1-Visitor
November 10, 2011
Solved

How the looking up works in this mathCAD example

  • November 10, 2011
  • 44 replies
  • 15005 views

Hi, there:

I am trying to using MathCAD to interpolate a value from a table in Excel.

I found the following post that is very similar to what I want. http://communities.ptc.com/message/29193

The last post got a MathCAD example that can reach this goal. (attached)

However, I cannot figure out how this been done?

How the interpolated happens? I didn't see any function to do this.

May you please give me some help for this?

Thanks,

Best answer by Fred_Kohlhepp

I tried to explain it to Mike, see my answer to his post.

Attached is the completed file, able to interpolate each column.

This could be made more streamlined with a little thought and effort.

44 replies

1-Visitor
November 10, 2011

I think there is a locked area that need password on that sheet.

24-Ruby IV
November 10, 2011

Where did you find in this worksheet a locked area?

1-Visitor
November 10, 2011

The 1st lock area is right under the first table.

The 2nd lock area is under the enter value S and D.

24-Ruby IV
November 10, 2011

Hello!

In Mathcad can be used as a linear interpolation (built-in function "linterp") and also cubic spline interpolation (built-in functions: "interp"; "cspline"; "pspline"; "lspline"). Please see the attachment with a simple example of interpolation in Mathcad.

P.S. Which version of Mathcad are you running (files attached for versions of MC12 and 15)?

1-Visitor
November 10, 2011

My version is MC15.

Thanks fo the examples. I am trying to do a simply linear interpolation. I will attach my worksheet as Mike mentioned soon.

Thanks,

1-Visitor
November 10, 2011

As Vladimir suggests there are many ways this can be achieved. To get the best results I would suggest you upload the data you are trying to interpolate between.

Mike

1-Visitor
November 10, 2011

Here is a function which I wrote.

Mike

1-Visitor
November 10, 2011

Mike,

Your check for values larger than max(x) does not work.

Lev

23-Emerald I
November 10, 2011

The sheet you found is a bad example of mathcad interpolation; most of the useful stuff is in the closed and locked area.

Interpolation in mathcad is possible a variety of ways, Read the help files for "interp" and "linterp"

"linterp" will do a straight-line interpolation between successive points and is very robust and easy if your points are closely spaced.

"interp" does a variety of curve fits to a data set.

1-Visitor
November 10, 2011

Thanks for all the replies. I am still new to mathCAD programming functions, even though I have been using MathCAD for 5-6 years, I only use the very basic functions for my structural calculation.

Please see the attached worksheet for the work that I am trying to work on.

What I need is something simliar to the original post I quoted.

The table is from a design code, with a give angle (22 degree), I need to interpolate all the numbers of the line of "20 degree" and "30-45 degree".

Thanks for all the help!

1-Visitor
November 10, 2011

Now you have a very tricky problem because of the way Mathcad uses the Interpolation functions. It requires the data to be in ascending order.

Mike

1-Visitor
November 10, 2011

Thanks, Mike.

If that is the case, I guess the alternative for my worksheet is to do the interpolation in Excel, which will give me a table of the slope degree from 0-90. Then I use the table lookup function in MatchCAD. The only extra step is I have to ask people to choose the angle, which can be done by the listbox function you taught me yesterday.