# How to find the equation from data?

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!

-
How is this recreational mathematics? – joriki Sep 12 '12 at 11:08
@joriki. I fixed it – Zeta.Investigator Sep 12 '12 at 11:08
It's not statistics, either -- I've replaced the tag by interpolation. – joriki Sep 12 '12 at 11:11
sorry, i don't know how that tag was made. – chenwan Sep 12 '12 at 11:23
PooyaM made it; see above. – joriki Sep 12 '12 at 11:35

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.
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$.
How do you mean, you couldn't really use either $l$ or $m$ as the dependent variable? What keeps you from doing it? – joriki Sep 12 '12 at 11:32