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.
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.
Or, you look up the help info on VLOOKUP and find that there's a way around TOL dependency:
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.
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.
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).