cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

How the looking up works in this mathCAD example

ptc-4323006
1-Visitor

How the looking up works in this mathCAD example

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,

44 REPLIES 44

Mike

Your interpolation is OK for the roof angle you used. Just doesn't work in general without more programing because of the ranges for the slope (as you have already noted).

The column headings are, as I said, for different areas. For a given roof angle (other variables fixed as well), the wind pressure on the roof is different for different areas. The columns are for determining the wind loads to be applied to those areas. The columns are not otherwise related. For a particular roof slope, the goal is to calculate the coefficient in each column.

Thanks for your clarification, Wayne. Good to meet someone from the same field here.

You suggestion of writing functions for each column is great and helpful.

I just want to explore a lot bit how interpolation between rows can happen.

I got a little lazy Wayne and didn't have time to make the program fully work. Either way I think we all got there in the end.

Mike

Thanks, Mike.

Wayne is right, this is a roof wind design. (He is also a structural engineer). Sorry I didn't explian myself very clear.

It's not pretty!

It's not clean!

Nicely done Fred, but I'm even more confused. I thought he said he has an angle of 22degrees. Therefore the first interpolation would be between GC.pf [ 1,1 and CG.pf [ 1,2 , or am I way off the mark???

Mike

For an interpolation (a linear one for simplicity) you need two pairs of (x,y) coordinates. We can interpolate between (5,1) and (20,2)--find the straight line thru the two points, then find the value of the second coordinate (y) that matches the x we have. Mathcad's "linterp" does just that, connecting line segments between successive pairs.

So this problem: we have a single row of values for x = 0 to 5, a row for x = 20, another row for x = 30 to 45, a row for 90.

So what is y for x = 3? well, we have a value for a range from 0 to 5, so we have y.

What y do we get for x = 10? We can interpolate between a x = 5 and x = 20.

We can interpolate between x = 20 and x = 30. From 30 to 45, y is the same value--linear interpolation will be the same value.

All I did was create enough slots in the value vectors (GCph_1, etc.) so linterp could work.

I wrote one function for GCpf_1 as an example, then I got lazy and left the rest as "An exercise for the student." The only column that it interpolates is column 1.

I said it wsn't pretty!

Right I see Fred cheers.

Mike

So what is y for x = 3? well, we have a value for a range from 0 to 5, so we have y.

What y do we get for x = 10? We can interpolate between a x = 5 and x = 20.

We can interpolate between x = 20 and x = 30. From 30 to 45, y is the same value--linear interpolation will be the same value

Thinking on, if x fell between 0-5 & 30-45 no interpolation would be required would it? Interpolation is only required when x falls outside the values in the table.

Mike

Mike Armstrong wrote:

Thinking on, if x fell between 0-5 & 30-45 no interpolation would be required would it? Interpolation is only required when x falls outside the values in the table.

Mike

Or, the interpolation is along a straight line with zero slope. (That's how linterp treats it.)

Or, the interpolation is along a straight line with zero slope. (That's how linterp treats it.)

Mike

Hi Fred:

Thanks for the help.

Though I think I didn't explain myself very clear. I am trying to see if I have a 22 degree, then what are the linear interpolation values between the line of "20" and "30-45 degree" will be, which is more close to what Mike is thinking.

Thanks,

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.

Thanks, Fred.

You are right, this can interpolate each column.

wayne
12-Amethyst
(To:ptc-4323006)

I attached an alternative to Fred's worksheet.

Announcements

Top Tags