How to find the equation from data?

94 Views Asked by At

I know things about linear/quadratic fittings etc. I'm just wondering, if i know a set of data for value e.g. z=[-2.563 -0.1932 -0.1502 -0.1102 -0.836 -0.5234] and l=[1 2 3 4 5 6] m=[6 5 4 3 2 1] I want to write out a function of z in terms of l and m. How would i be able to start this? Many thanks in advance!

1

There are 1 best solutions below

13
On

The values of $(l,m)$ all lie on one line, so this isn't actually a two-dimensional problem; you can just do a one-dimensional fit with respect to either $l$ or $m$. Then if you want to evaluate the function at an arbitrary point $(l,m)$, just project it onto the line $l+m=7$ and evaluate the fitted function there.

[Edit in response to comment:]

You only have function values on a single line. The best you can do if you want to approximate a function value off the line is to take the function value at the closest point on the line, which is the orthogonal projection of the point onto the line. The orthogonal projection of the point $(l,m)$ onto the line $l+m=7$ is $((7+l-m)/2,(7+m-l)/2)$, so you get the approximation by evaluating a function fitted with respect to $l$ at $(7+l-m)/2$ or evaluating a function fitted with respect to $m$ at $(7+m-l)/2$.