Multi variable regression

108 Views Asked by At

I have a matrix which contains hand-calculated values as a function of 2 variables x & y.
The range of x is given in the first column (0-0.15) and the range of y is given in the first row (0-200). Both ranges are non-discrete (i.e. x = 0.02 is legal).

$$ \begin{matrix} x\y & 0 & 1 & 2 & 3 & 5 & 10 & 20 & 50 & 100 & 200 \\ 0 & 7.4 & 7.4 & 8.5 & 10.2 & 13 & 22 & 32 & 55 & 90 & 150 \\ 0.01 & 7.4 & 7.4 & 8.5 & 10.2 & 13 & 22 & 32 & 55 & 90 & 150 \\ 0.03 & 5.7 & 5.7 & 6.8 & 8.3 & 12 & 19.2 & 27.5 & 50 & 80 & 140 \\ 0.05 & 3.5 & 3.5 & 4.3 & 5.8 & 10 & 16.5 & 25 & 40 & 65 & 110 \\ 0.07 & 3.3 & 3.3 & 3.9 & 5.4 & 8.5 & 13.9 & 22 & 37 & 56 & 75 \\ 0.1 & 3.2 & 3.2 & 3.7 & 5.2 & 8.2 & 13.4 & 20 & 33 & 45 & 65 \\ 0.15 & 3.1 & 3.1 & 3.5 & 5 & 8 & 13 & 18 & 30 & 40 & 60 \end{matrix} $$

I'm looking for a way to derive a formula which takes x & y and returns a value according to the above matrix with a minimum error.
For example, f(0.04, 4) should give a result of ~9 as it's around the middle of the sub matrix corresponding to 0.03 <= x <= 0.05 and 3 <= y <= 5.
I tried to use a simple regression but it gave results with too much error.

1

There are 1 best solutions below

0
On BEST ANSWER

Use Bilinear Interpolation to get the best results. Here is a link that you can verify. Load the data into a two dimensional array. Then write a small macro to do the bilinear interpolation to get the value of a function between four diagonal points. This will have the least error as it takes the gradients of both x and y and is quite often used in image processing.

https://en.wikipedia.org/wiki/Bilinear_interpolation

Good luck.