Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Define Piecewise Function from Input Table

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-03-2018
03:12 AM

10-03-2018
03:12 AM

All,

I'm attempting to start what should be a simple geotechnical effective stress calculation. My first step is defining a soil unit weight profile as a function of depth (z) in an efficient and robust method. In the past, I've used "if statements" to control this however they are cumbersome and not very sophisticated. An example of what I've done in the past is shown on Page 2 of the attached worksheet.

On Page 1 I attempted using "vlookup", however I ran into numerical issues and precision errors due to TOL...ideally, I would like to end up with a function that is as simple as the "vlookup" approach, but with the precision of the function defined by the "if statement". Any suggestions would be appreciated...I've attempted "for loops" and "while loops" without any success.

Thanks in advance!

Solved! Go to Solution.

Labels:

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-03-2018
06:07 AM

12 REPLIES 12

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-03-2018
03:48 AM

10-03-2018
03:48 AM

Re: Define Piecewise Function from Input Table

Hi,

Look up linear interpolation in help. You can arrange a matrix of depths and values to interpolate.

For example here is one that changes from compass direction to polar plot direction. The tolerance is built in.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-03-2018
06:07 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-03-2018
07:47 AM

10-03-2018
07:47 AM

Re: Define Piecewise Function from Input Table

Wouldn't

be a simpler but equivalent solution to your compass problem?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-03-2018
10:06 AM

10-03-2018
10:06 AM

Re: Define Piecewise Function from Input Table

I can't demonstrate it because "linterp" is a "premium function", but this should do what you want:

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-03-2018
10:07 AM

10-03-2018
10:07 AM

Re: Define Piecewise Function from Input Table

Or, you look up the help info on VLOOKUP and find that there's a way around TOL dependency:

Success!

Luc

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-03-2018
11:19 AM

10-03-2018
11:19 AM

Re: Define Piecewise Function from Input Table

Nice idea and it even can be streamlined a little bit:

Drawback may be that it fails for input values greater or equal to 30 ft.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-09-2018
10:37 PM

10-09-2018
10:37 PM

Re: Define Piecewise Function from Input Table

Thanks so much for the assistance on this. There were a lot of great solutions to this question, but implementing a *custom *look-up function seemed to be the most efficient method in defining my profile of soil properties as a function of depth.

Thanks again!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-05-2019
09:02 PM

08-05-2019
09:02 PM

Re: Define Piecewise Function from Input Table

Does anybody here use "SMath Studio"? I'm trying to recreate this sheet using SMath, but can't seem to get the same lookup function to work out (see attached screenshot).

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-06-2019
01:53 AM

08-06-2019
01:53 AM

Re: Define Piecewise Function from Input Table

Attach the sheet... NOT just a picture.

Luc

Top Tags