Interpolating a Surface: Finding Approximations for Thermodynamic Properties

  • Thread starter Thread starter Saladsamurai
  • Start date Start date
  • Tags Tags
    Surface
Saladsamurai
Messages
3,009
Reaction score
7
So I have this surface that I am trying to make approximations on. Now I have values for f(x_1,y_1) and f(x_2,y_2). I want to find the value of f(x,y) where x and y lie between (x1, x2) and (y1, y2). I am willing to assume that f changes linearly in both x and y for this small interval. Would the appropriate interpolation function then be

f(x,y)=f(x_1,y_1) + \frac{f(x_2,y_2) - f(x_1,y_1)}{x_2 - x_1} *(x - x_1) + \frac{f(x_2,y_2) - f(x_1,y_1)}{y_2 - y_1} *(y - y_1)

?

I feel like it would be ... but I also feel like it could be

<br /> f(x,y)=<br /> f(x_1,y_1) + <br /> \sqrt{<br /> [\frac{f(x_2,y_2) - f(x_1,y_1)}{x_2 - x_1} *(x - x_1)]^2<br /> + <br /> [\frac{f(x_2,y_2) - f(x_1,y_1)}{y_2 - y_1} *(y - y_1)]^2<br /> }<br />What do you think? I am really confusing myself here :smile: First or second one?
 
Physics news on Phys.org
Your second possibility isn't first degree in its variables, which is what I think you mean. Let's say f(x1,y1) = z1 and f(x2,y2) = z2

Then a general plane through the first point would be:

z = a(x-x1) + b(y - y1) + z1.

Making the plane go through the second plane requires:

z2 = a(x2-x1) + b(y2 - y1) + z1

This does not completely determine a and b. The problem is that there are infinitely many planes, first degree in each variable, passing through those two points, so there isn't any reasonable way to pick a best one. If you think about the straight line joining your two points in 3D, any plane containing that line interpolates your two points. You need another condition.
 
Hi LCKurtz :smile: I think I am more confused now haha. I am thinking along the lines of something like this: I have some value f(x1,y1). Now couldn;t I say that for some local region "around" the point (x1,y1) I can approximate f(x,y) = f(x1,y1) + Δf where Δf is the "finite analog" to df = (\partial{f} /\partial{x})*dx + (\partial{f}/\partial{y})*dy.

Am I still missing your point? Or does that work? Note that this is a "real problem" that I am working on here. I have some tabulated data and I am making some assumptions about the nature of the unknown funciton.

Thanks.
 
LCKurtz said:
Your second possibility isn't first degree in its variables, which is what I think you mean. Let's say f(x1,y1) = z1 and f(x2,y2) = z2

Then a general plane through the first point would be:

z = a(x-x1) + b(y - y1) + z1.

Making the plane go through the second plane requires:

z2 = a(x2-x1) + b(y2 - y1) + z1

This does not completely determine a and b. The problem is that there are infinitely many planes, first degree in each variable, passing through those two points, so there isn't any reasonable way to pick a best one. If you think about the straight line joining your two points in 3D, any plane containing that line interpolates your two points. You need another condition.

Saladsamurai said:
Hi LCKurtz :smile: I think I am more confused now haha. I am thinking along the lines of something like this: I have some value f(x1,y1). Now couldn;t I say that for some local region "around" the point (x1,y1) I can approximate f(x,y) = f(x1,y1) + Δf where Δf is the "finite analog" to df = (\partial{f} /\partial{x})*dx + (\partial{f}/\partial{y})*dy.

Am I still missing your point? Or does that work? Note that this is a "real problem" that I am working on here. I have some tabulated data and I am making some assumptions about the nature of the unknown funciton.

Thanks.

Yes, you could with more information. That is the same thing as my suggestion z = a(x-x1) + b(y - y1) + z1 where your two partials are my a and b. The problem is that you don't have enough information to estimate the two partials fx and fy, which are a and b.
 
LCKurtz said:
Yes, you could with more information. That is the same thing as my suggestion z = a(x-x1) + b(y - y1) + z1 where your two partials are my a and b. The problem is that you don't have enough information to estimate the two partials fx and fy, which are a and b.

I am sorry, I still don't follow. I thought that I did estimate the two partials :confused:

(\partial{f} /\partial{x}) \approx \frac{f(x_2,y_2) - f(x_1,y_1)}{x_2 - x_1} \text{ and }(\partial{f} /\partial{y}) \approx\frac{f(x_2,y_2) - f(x_1,y_1)}{y_2 - y_1} <br />
 
But you wouldn't estimate the fx by changing the y variable nor fy by changing the x variable. You would hold the other variable constant.

Anyway, I'm guessing you haven't really posted what you want or need. Bivariate approximation is a big subject. Do you have a rectangular grid in the xy plane where you know the values? Or scattered values?

I would suggest you Google interpolation of surfaces and look around. You might find just what you need.
 
LCKurtz said:
But you wouldn't estimate the fx by changing the y variable nor fy by changing the x variable. You would hold the other variable constant.

Anyway, I'm guessing you haven't really posted what you want or need. Bivariate approximation is a big subject. Do you have a rectangular grid in the xy plane where you know the values? Or scattered values?

I would suggest you Google interpolation of surfaces and look around. You might find just what you need.

Actually, I have been Googling around and got so confused that I came here :redface:

Let me post an example. I have a bunch of data tabulated as follows,

Screenshot2010-08-23at122349AM.png


You can see that for some value of "P" in the header (for example P = 0.06 MPa) we have a bunch of Temperatures and corresponding values of properties. For example for
P = 0.06 MPa we can scroll down to T = 10 and see that the corresponding value of v is
v = 0.37861.

Similarly we can see that for P = 0.10 MPa and T = 30 we have v = 0.24216.

My question is what if I want to approximate a value of v for P = 0.08 MPa and T = 15 ?

I cannot seem to figure out what kind of bivariate interpolation this falls under, nor do I know what determines which kind of interpolation I should use. It seems like I have a regular rectangular grid here... I think. But not all of the tables like the ones above have the same temperature range. But working with the 2 above would be a good start.
 
This is getting a bit out of my area of expertise. One method I have read a bit about is the quadratic Shepard's method. This interpolates 2d data with a smooth quadratic function. There are implementations in Fortran and I suppose other languages. For example, look at:

http://people.sc.fsu.edu/~jburkardt/f_src/qshep2d/qshep2d.html

I'm afraid beyond that, I can't help you much.
 
Last edited by a moderator:
LCKurtz said:
This is getting a bit out of my area of expertise. One method I have read a bit about is the quadratic Shepard's method. This interpolates 2d data with a smooth quadratic function. There are implementations in Fortran and I suppose other languages. For example, look at:

http://people.sc.fsu.edu/~jburkardt/f_src/qshep2d/qshep2d.html

I'm afraid beyond that, I can't help you much.

Ok. thanks for your help! :smile: I have never had to interpolate about 2 axes before. I have done plenty of regular linear interpolation and thought it was a simple jump to do 2D. I guess I thought wrong, eh? :smile:
 
Last edited by a moderator:
  • #10
Saladsamurai said:
You can see that for some value of "P" in the header (for example P = 0.06 MPa) we have a bunch of Temperatures and corresponding values of properties. For example for
P = 0.06 MPa we can scroll down to T = 10 and see that the corresponding value of v is
v = 0.37861.

Similarly we can see that for P = 0.10 MPa and T = 30 we have v = 0.24216.

My question is what if I want to approximate a value of v for P = 0.08 MPa and T = 15 ?

For these kind of thermodynamic problems, there can be different formulas for different input variable ranges e.g. PV = mRT is one simple formula. However, heat transfer has different formula for different ranges of the inputs.

Best possible thing I can think of at the moment is getting sufficient information to construct a plane. Two points A and B have infinite number of planes. If you get one or more points, you make a plane and use the points as estimation. This should work for smooth graphs without discontinuities.
 
Last edited:
Back
Top