I have the raw data of $X$, $Y$, $Z$, where $X$ and $Y$ are inputs and $Z$ is the output. Plotting the surface gives the red curve:enter image description here

The surface seems to be a simple function involving trigonometric functions. For example, plotting the equation $\cos(X)^2 + \cos(Y)^2$ gives the blue surface and it looks similar to the red graph (but the RMS error is very large). I have tried introducing variables ($a_1\cos(X)^2 + a_2\cos(Y)^2$, where $a_1$ and $a_2$ vary from $0$ to $1$) but the RMS error is still large.

How can I find the equation which gives the red surface?

  • $\begingroup$ Perhaps consider NURBS or B-Spline based surfaces? $\endgroup$
    – NNN
    Feb 21 at 6:04
  • 3
    $\begingroup$ If you cannot come up with other ideas (e.g., some quadratic function) and do not have prior knowledge (e.g., from physics, data generating process), I'd suggest symbolic regression. There are Python and Julia packages available that implement this. $\endgroup$
    – cos_theta
    Feb 21 at 8:18
  • 4
    $\begingroup$ Most curves/surfaces do not correspond to close-form formulas. What makes you think that such a formula exists? $\endgroup$ Feb 21 at 13:20
  • $\begingroup$ Are you familiar with least-squares regression? Given some candidate functions e.g., polynomials. you can find the linear combination that yields the least error over your dataset. Least squares with degree $\leq 2$ polynomials look like they should yeild a decent fit. $\endgroup$
    – whpowell96
    Feb 21 at 15:52
  • $\begingroup$ @cos_theta, I will try that out. $\endgroup$ Feb 22 at 2:39


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.