0
$\begingroup$

I have I really complicated equation, but for simplicity lets assume my function is F(x,y,z)= ax+by+c*z, where a, b and c are some unknown constants.

From experiments we know that at:

x=3, y=2, z=1 then F=10

x=2, y=1, z=0 then F=4

x=1, y=0, z=0 then F=1

So, is there any way to plot F(x,y,z) as contour plot and then fit my data above in order to extract the exact unknown coefficient?

By the way the example answer is a=1, b=2 and c=3.

$\endgroup$
  • $\begingroup$ for the example posted, you can use {a, b, c} = LinearSolve[data[[All, ;; 3]], data[[All, -1]]] or {a, b, c} = LeastSquares[data[[All, ;; 3]], data[[All, -1]]] $\endgroup$ – kglr Dec 11 '19 at 23:15
0
$\begingroup$
Clear["Global`*"]

f[x_, y_, z_] = a*x + b*y + c*z;

Your data is the form {x, y, z, f}

data = {{3, 2, 1, 10}, {2, 1, 0, 4}, {1, 0, 0, 1}};

Each set of the data generates one equation

eqns = f @@ Most[#] == Last@# & /@ data

(* {3 a + 2 b + c == 10, 2 a + b == 4, a == 1} *)

There are three equations and three unknown coefficients; consequently, the system can be solved

sol = Solve[eqns, {a, b, c}][[1]]

(* {a -> 1, b -> 2, c -> 3} *)

The form of the function is

f[x, y, z] /. sol

(* x + 2 y + 3 z *)
$\endgroup$
  • $\begingroup$ Since my data are experimental (more than three points) and with complicated relation I was unable to solve it using system of equation. That's why if this problem can be solved using contour plot or in any other graphical technique ? $\endgroup$ – Love Eva Nov 12 '19 at 2:31
  • $\begingroup$ If you can make a plot you must have a model. Is there something that prevents you from using NonlinearModelFit to fit your data to that model? $\endgroup$ – Bob Hanlon Nov 12 '19 at 3:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.