Extracting function from contour plot

3dfunctionsgraphing-functions

I have made a contour plot via Minitab and got an image like this one:

contour plot

With

  • $z$ being the enthalpy $[BTU/lb]$
  • $x$ being the temperature $[°F]$
  • $y$ being the concentration [%]

How can I mathematically access its function $z = f(x,y)$ from just the data behind the picture?
Is there a possibility to get $z = f(x,y)$ from this via programming/software?

EDIT:

Part of my data:

x = Concentration [%] y = Temperature [°F] z = Enthalpy [BTU / lb]
0 32 4
5 32 -16
10 32 -32
15 32 -48
20 32 -63
25 32 -76
30 32 -90
35 32 -103
40 32 -116
45 32 -124
50 32 -128
55 32 -132
60 32 -136
65 32 -139
70 32 -136
75 32 -128
80 32 -118
85 32 -100
90 32 -75
95 32 -40
100 32 2
0 50 16
5 50 0
10 50 -18
15 50 -32
20 50 -48
25 50 -63
30 50 -78
35 50 -90
40 50 -100
45 50 -111
50 50 -118
55 50 -123
60 50 -125
65 50 -128
70 50 -125
75 50 -121
80 50 -112
85 50 -96
90 50 -70
95 50 -37
100 50 4

Picture:

nomogram

@Claude:

  • BTU/lb_5 = – 48,72 + 1,007 Temp – 0,000163 Temp^2
  • BTU/lb_10 = – 65,25 + 1,001 Temp – 0,000287 Temp^2
  • BTU/lb_15 = – 77,55 + 0,9209 Temp – 0,000163 Temp^2
  • BTU/lb_20 = – 90,01 + 0,8385 Temp + 0,000043 Temp^2
  • BTU/lb_25 = – 100,7 + 0,7528 Temp + 0,000226 Temp^2

Best Answer

Follows a MATHEMATICA script that I hope, will express with sufficient accuracy, the formulation needed $z = f(x,y)$

data1 = {{5, -48.72}, {10, -65.25}, {15, -77.55}, {20, -90.01}, {25,-100.7}};
data2 = {{5, 1.007}, {10, 1.001}, {15, 0.9209}, {20, 0.8385}, {25, 0.7528}};
data3 = {{5, -0.000163}, {10, -0.000287}, {15, -0.000163}, {20, 0.000043}, {25, 0.000226}};

fc1 = c10 + c11 w + c12 w^2 + c13 w^3 + c14 w^4;
fc2 = c20 + c21 w + c22 w^2 + c23 w^3 + c24 w^4;
fc3 = c30 + c31 w + c32 w^2 + c33 w^3 + c34 w^4;

c0 = NonlinearModelFit[data1, fc1, {c10, c11, c12, c13, c14}, w];
c1 = NonlinearModelFit[data2, fc2, {c20, c21, c22, c23, c24}, w];
c2 = NonlinearModelFit[data3, fc3, {c30, c31, c32, c33, c34}, w];

f[Temp_, w_] := -(c0[w] + c1[w] Temp + c2[w] Temp^2)

ContourPlot[f[Temp, w], {w, 5, 25}, {Temp, 0, 100}, Contours -> 15, ContourShading -> None]

enter image description here

Plot[{f[Temp, 15], f[Temp, 17], f[Temp, 20]}, {Temp, 0, 100}]

enter image description here

Added a python script to define $z = f(x,y)$

from scipy.optimize import curve_fit

def coefs(w,c0,c1,c2,c3,c4):
    return c0 + c1*w + c2*w ** 2 + c3*w ** 3 + c4*w ** 4

x_values  = [5., 10., 15., 20., 25.]
c0_values = [48.72, 65.25, 77.55, 90.01, 100.7]
c1_values = [-1.007, -1.001, -0.9209, -0.8385, -0.7528]
c2_values = [0.000163, 0.000287, 0.000163, -0.000043, -0.000226]

coefsc0, _ = curve_fit(coefs, x_values, c0_values)
coefsc1, _ = curve_fit(coefs, x_values, c1_values)
coefsc2, _ = curve_fit(coefs, x_values, c2_values)


def C(p, x):
    val = 0
    for i, pp in enumerate(p):
        val += pp * x**i
    return val


def f(t,w):
    return C(coefsc0,w) + (C(coefsc1,w) + C(coefsc2,w)*t)*t

print(f(0,15))
Related Question