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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Interpolation with two variables

mrretsil
3-Newcomer

Interpolation with two variables

Dear fellow Mathcad users,

 

Please see attached screenshot, I am trying to find Variable rT (top row) for a given value of rR (left hand row) and a second variable called S (the numbers in the body of the table).

  

I think the solution will be found by initially creating a submatrix that is one row high based upon the variable in the left column, and then outputting the variable in the top row based on an interpolation of the new submatrix.  I am trying to get to that solution, but my efforts are so far in vain, (I have been trying to adapt the Mathcad example attached to my needs but no success yet).  Note that I want to linerly interpolate, and not to generate a spline.

 

Any help on this would be much appreciated.

 

Best regards, mrretsil

3 REPLIES 3
Werner_E
25-Diamond I
(To:mrretsil)

You may be interested in the attached file. From your text I understood that you'd like to provide 1 and 3.2 and are looking for a function to give you the 0.2.

But the program you show performs a simple normal interpolation.

Furthermore you wrote that you'd like to use lienar interpolation, but you program uses splines (difference between cspline and lsline is only the behaviour at the ends - both are cubic splines).

You find linear interpolation in the attached file.

For further discussion it would be more helpful if you provide yor Mathcad sheet anmd sample data. You may have to zip the file before thos system here would accept it as attachment.

If your goal really ist f(1, 3.2)=0.2, you would have to explain what should hapen if you enter f(1.12, 3.4)=?

And which result do you expect in case of this data (0.2 or 1.0)

 

Bild.png

I can think of a lot of situations where the result would be quite ambigous. After all you can demand that the row- and column headers afre in ascending order (you can always force that unless we have two identical values which would be nonsense anyway) but you sure can't demand that all rows and all columns of the data are in ascending or descending order.

 

Werner_E
25-Diamond I
(To:Werner_E)

Here is a quick hack using normal interpolation from my toolbox and a solve block to give you the value of the top row.

If there are more solitions, the guess value decides which one you get.

Bild.png

mrretsil
3-Newcomer
(To:Werner_E)

Thank you for the response, I hadn't noticed that the data was not strictly in ascending / descending order.  I think the second sheet will work for me, I really appreciate the suggestion, thanks again.

Announcements

Top Tags