Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

share|cite|improve this question
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.

[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$.

share|cite|improve this answer
could you please explain more about projection part? I don't quite get that. – chenwan Sep 12 '12 at 11:24
my situation is as follows, I have a matrix of z values depending on the l and m value, l always starts from 1 to some number n while m goes from n till 1. for example, with l= 1 2 3 4 5 ,m=5 4 3 2 1 and this z value will be a length of 5 vector which is totally different as the case with l=1 2 3 4 5 6 7 and m=7 6 5 4 3 2 1. So i couldn't really just use either l or m as the dependent variable to form the function of z. In that case, i wouldn't use that function to find z for all cases. Thank you anyway! – chenwan Sep 12 '12 at 11:24
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
if i use l as dependent variable in first case, when l is 1, it gives a z value according to the function which is true as my original value of z. However, we can't use that l=1 to find z for another case. Unless, i have z in terms of l and m the same time. – chenwan Sep 12 '12 at 11:38
are you saying i find a fit of z in terms of 7+m-l/2? – chenwan Sep 12 '12 at 11:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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